Compare commits

..

No commits in common. "402ca17600d57e2a3569771eb57881c42d5db0e4" and "168fd80fbf25c5cb20322fa5af38d5d49376d737" have entirely different histories.

18 changed files with 133 additions and 170 deletions

@ -1 +1 @@
Subproject commit 832685b6a942a6ebbec8e1e5b8c33b6b85b0a727
Subproject commit 9753b06eded9186429380f002a073adee06dccfc

View File

@ -1258,7 +1258,8 @@ handle_mhd_request (void *cls,
.url = "kyc-proof",
.method = MHD_HTTP_METHOD_GET,
.handler.get = &TEH_handler_kyc_proof,
.nargs = 1
.nargs = 128,
.nargs_is_upper_bound = true
},
{
.url = "kyc-wallet",

View File

@ -256,41 +256,30 @@ clean_kpc (struct TEH_RequestContext *rc)
MHD_RESULT
TEH_handler_kyc_proof (
struct TEH_RequestContext *rc,
const char *const args[1])
const char *const args[3])
{
struct KycProofContext *kpc = rc->rh_ctx;
const char *provider_section_or_logic = args[0];
const char *h_payto;
if (NULL == kpc)
{
/* first time */
if (NULL == provider_section_or_logic)
if ( (NULL == args[0]) ||
(NULL == args[1]) )
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
"'/kyc-proof/$PROVIDER_SECTION?state=$H_PAYTO' required");
}
h_payto = MHD_lookup_connection_value (rc->connection,
MHD_GET_ARGUMENT_KIND,
"state");
if (NULL == h_payto)
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MISSING,
"h_payto");
"'/kyc-proof/$H_PATYO/$LOGIC' required");
}
kpc = GNUNET_new (struct KycProofContext);
kpc->rc = rc;
rc->rh_ctx = kpc;
rc->rh_cleaner = &clean_kpc;
if (GNUNET_OK !=
GNUNET_STRINGS_string_to_data (h_payto,
strlen (h_payto),
GNUNET_STRINGS_string_to_data (args[0],
strlen (args[0]),
&kpc->h_payto,
sizeof (kpc->h_payto)))
{
@ -301,7 +290,7 @@ TEH_handler_kyc_proof (
"h_payto");
}
if (GNUNET_OK !=
TALER_KYCLOGIC_lookup_logic (provider_section_or_logic,
TALER_KYCLOGIC_lookup_logic (args[1],
&kpc->logic,
&kpc->pd,
&kpc->provider_section))
@ -310,14 +299,14 @@ TEH_handler_kyc_proof (
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_EXCHANGE_KYC_GENERIC_LOGIC_UNKNOWN,
provider_section_or_logic);
args[1]);
}
if (NULL != kpc->provider_section)
{
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Absolute expiration;
if (0 != strcmp (provider_section_or_logic,
if (0 != strcmp (args[1],
kpc->provider_section))
{
GNUNET_break_op (0);
@ -363,6 +352,7 @@ TEH_handler_kyc_proof (
}
kpc->ph = kpc->logic->proof (kpc->logic->cls,
kpc->pd,
&args[2],
rc->connection,
&kpc->h_payto,
kpc->process_row,

View File

@ -105,12 +105,6 @@ static struct GNUNET_TIME_Absolute shard_end_time;
*/
static struct GNUNET_TIME_Relative shard_delay;
/**
* How long did we take to finish the last shard
* for this account?
*/
static struct GNUNET_TIME_Relative longpoll_timeout;
/**
* Name of our job in the shard table.
*/
@ -480,7 +474,7 @@ transaction_completed (void)
struct GNUNET_TIME_Relative left;
latency = GNUNET_TIME_absolute_get_duration (hh_start_time);
left = GNUNET_TIME_relative_subtract (longpoll_timeout,
left = GNUNET_TIME_relative_subtract (LONGPOLL_TIMEOUT,
latency);
delayed_until = GNUNET_TIME_relative_to_absolute (left);
}
@ -1163,7 +1157,7 @@ continue_with_shard (void *cls)
limit,
test_mode
? GNUNET_TIME_UNIT_ZERO
: longpoll_timeout,
: LONGPOLL_TIMEOUT,
&history_cb,
NULL);
if (NULL == hh)
@ -1371,11 +1365,6 @@ main (int argc,
"exit-on-error",
"terminate wirewatch if we failed to download information from the bank",
&exit_on_error),
GNUNET_GETOPT_option_relative_time ('f',
"longpoll-timeout",
"DELAY",
"what is the timeout when asking the bank about new transactions",
&longpoll_timeout),
GNUNET_GETOPT_option_flag ('I',
"ignore-not-found",
"continue, even if the bank account of the exchange was not found",
@ -1401,7 +1390,6 @@ main (int argc,
};
enum GNUNET_GenericReturnValue ret;
longpoll_timeout = LONGPOLL_TIMEOUT;
if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))

View File

@ -117,6 +117,9 @@ BEGIN
' ADD CONSTRAINT ' || table_name || '_foreign_partner_serial_id'
' FOREIGN KEY (partner_serial_id) '
' REFERENCES partners(partner_serial_id) ON DELETE CASCADE'
',ADD CONSTRAINT ' || table_name || '_foreign_reserve_pub'
' FOREIGN KEY (reserve_pub) '
' REFERENCES reserves (reserve_pub) ON DELETE CASCADE'
',ADD CONSTRAINT ' || table_name || '_foreign_purse_pub'
' FOREIGN KEY (purse_pub) '
' REFERENCES purse_requests (purse_pub) ON DELETE CASCADE'

View File

@ -3600,7 +3600,8 @@ struct TALER_EXCHANGE_KycProofHandle;
* @param h_payto hash of payto URI identifying the target account
* @param logic name of the KYC logic to run
* @param args additional args to pass, can be NULL
* or a string to append to the URL. Must then begin with '&'.
* or a string to append to the URL. Must
* then begin with '/' or '?'.
* @param cb function to call with the result
* @param cb_cls closure for @a cb
* @return NULL on error

View File

@ -303,6 +303,7 @@ struct TALER_KYCLOGIC_Plugin
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param pd provider configuration details
* @param url_path rest of the URL after `/kyc-webhook/$H_PAYTO/$LOGIC`
* @param connection MHD connection object (for HTTP headers)
* @param account_id which account to trigger process for
* @param process_row row in the legitimization processes table the legitimization is for
@ -315,6 +316,7 @@ struct TALER_KYCLOGIC_Plugin
struct TALER_KYCLOGIC_ProofHandle *
(*proof)(void *cls,
const struct TALER_KYCLOGIC_ProviderDetails *pd,
const char *const url_path[],
struct MHD_Connection *connection,
const struct TALER_PaytoHashP *account_id,
uint64_t process_row,

View File

@ -868,24 +868,6 @@ struct GNUNET_OS_Process *
TALER_TESTING_run_bank (const char *config_filename,
const char *bank_url);
/**
* Prepare libeufin sandbox execution. Check if the port is available and
* reset database.
*
* @param config_filename configuration file name.
* @param reset_db should we reset the bank's database
* @param config_section which configuration section should be used
* @param[out] bc set to the bank's configuration data
* @return #GNUNET_OK on success
*/
enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_libeufin (const char *config_filename,
bool reset_db,
const char *config_section,
struct TALER_TESTING_BankConfiguration *bc);
/**
* Start the (nexus) bank process. Assume the port
* is available and the database is clean. Use the "prepare
@ -927,7 +909,7 @@ TALER_TESTING_run_fakebank (const char *bank_url,
*/
enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_bank (const char *config_filename,
bool reset_db,
int reset_db,
const char *config_section,
struct TALER_TESTING_BankConfiguration *bc);
@ -2535,6 +2517,7 @@ TALER_TESTING_cmd_check_kyc_get (const char *label,
* @param logic_section name of the KYC provider section
* in the exchange configuration for this proof
* @param code OAuth 2.0 code to use
* @param state OAuth 2.0 state to use
* @param expected_response_code expected HTTP status
* @return the command
*/
@ -2544,6 +2527,7 @@ TALER_TESTING_cmd_proof_kyc_oauth2 (
const char *payment_target_reference,
const char *logic_section,
const char *code,
const char *state,
unsigned int expected_response_code);

View File

@ -643,6 +643,7 @@ proof_reply (void *cls)
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param pd provider configuration details
* @param url_path rest of the URL after `/kyc-webhook/`
* @param connection MHD connection object (for HTTP headers)
* @param account_id which account to trigger process for
* @param process_row row in the legitimization processes table the legitimization is for
@ -655,6 +656,7 @@ proof_reply (void *cls)
static struct TALER_KYCLOGIC_ProofHandle *
kycaid_proof (void *cls,
const struct TALER_KYCLOGIC_ProviderDetails *pd,
const char *const url_path[],
struct MHD_Connection *connection,
const struct TALER_PaytoHashP *account_id,
uint64_t process_row,

View File

@ -474,17 +474,18 @@ initiate_task (void *cls)
hps = GNUNET_STRINGS_data_to_string_alloc (&ih->h_payto,
sizeof (ih->h_payto));
GNUNET_asprintf (&redirect_uri,
"%skyc-proof/%s",
"%s/kyc-proof/%s/%s/%s",
ps->exchange_base_url,
pd->section);
hps,
pd->section,
legi_s);
redirect_uri_encoded = TALER_urlencode (redirect_uri);
GNUNET_free (redirect_uri);
GNUNET_asprintf (&url,
"%s?response_type=code&client_id=%s&redirect_uri=%s&state=%s",
"%s?client_id=%s&redirect_uri=%s",
pd->login_url,
pd->client_id,
redirect_uri_encoded,
hps);
redirect_uri_encoded);
GNUNET_free (redirect_uri_encoded);
ih->cb (ih->cb_cls,
TALER_EC_NONE,
@ -610,7 +611,7 @@ handle_proof_error (struct TALER_KYCLOGIC_ProofHandle *ph,
ph->response
= TALER_MHD_make_error (
TALER_EC_EXCHANGE_KYC_PROOF_BACKEND_INVALID_RESPONSE,
"Unexpected response from KYC gateway: proof error");
"Unexpected response from KYC gateway");
ph->http_status
= MHD_HTTP_BAD_GATEWAY;
return;
@ -678,7 +679,7 @@ parse_proof_success_reply (struct TALER_KYCLOGIC_ProofHandle *ph,
ph->response
= TALER_MHD_make_error (
TALER_EC_EXCHANGE_KYC_PROOF_BACKEND_INVALID_RESPONSE,
"Unexpected response from KYC gateway: proof success must contain data and status");
"Unexpected response from KYC gateway");
ph->http_status
= MHD_HTTP_BAD_GATEWAY;
return;
@ -713,7 +714,7 @@ parse_proof_success_reply (struct TALER_KYCLOGIC_ProofHandle *ph,
ph->response
= TALER_MHD_make_error (
TALER_EC_EXCHANGE_KYC_PROOF_BACKEND_INVALID_RESPONSE,
"Unexpected response from KYC gateway: data must contain id");
"Unexpected response from KYC gateway");
ph->http_status
= MHD_HTTP_BAD_GATEWAY;
return;
@ -796,23 +797,15 @@ handle_curl_login_finished (void *cls,
const char *token_type;
uint64_t expires_in_s;
const char *refresh_token;
bool no_expires;
bool no_refresh;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("access_token",
&access_token),
GNUNET_JSON_spec_string ("token_type",
&token_type),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint64 ("expires_in",
&expires_in_s),
&no_expires
),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("refresh_token",
&refresh_token),
&no_refresh
),
GNUNET_JSON_spec_uint64 ("expires_in",
&expires_in_s),
GNUNET_JSON_spec_string ("refresh_token",
&refresh_token),
GNUNET_JSON_spec_end ()
};
CURL *eh;
@ -832,7 +825,7 @@ handle_curl_login_finished (void *cls,
ph->response
= TALER_MHD_make_error (
TALER_EC_EXCHANGE_KYC_PROOF_BACKEND_INVALID_RESPONSE,
"Unexpected response from KYC gateway: login finished");
"Unexpected response from KYC gateway");
ph->http_status
= MHD_HTTP_BAD_GATEWAY;
break;
@ -925,6 +918,7 @@ handle_curl_login_finished (void *cls,
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param pd provider configuration details
* @param url_path rest of the URL after `/kyc-webhook/`
* @param connection MHD connection object (for HTTP headers)
* @param account_id which account to trigger process for
* @param process_row row in the legitimization processes table the legitimization is for
@ -937,6 +931,7 @@ handle_curl_login_finished (void *cls,
static struct TALER_KYCLOGIC_ProofHandle *
oauth2_proof (void *cls,
const struct TALER_KYCLOGIC_ProviderDetails *pd,
const char *const url_path[],
struct MHD_Connection *connection,
const struct TALER_PaytoHashP *account_id,
uint64_t process_row,
@ -949,6 +944,7 @@ oauth2_proof (void *cls,
struct TALER_KYCLOGIC_ProofHandle *ph;
const char *code;
(void) url_path;
GNUNET_break (NULL == provider_user_id);
ph = GNUNET_new (struct TALER_KYCLOGIC_ProofHandle);
GNUNET_snprintf (ph->provider_legitimization_id,
@ -963,7 +959,6 @@ oauth2_proof (void *cls,
GNUNET_free (ph);
return NULL;
}
ph->pd = pd;
ph->connection = connection;
ph->h_payto = *account_id;
@ -1013,24 +1008,23 @@ oauth2_proof (void *cls,
char *client_secret;
char *authorization_code;
char *redirect_uri_encoded;
char *hps;
hps = GNUNET_STRINGS_data_to_string_alloc (&ph->h_payto,
sizeof (ph->h_payto));
GNUNET_asprintf (&redirect_uri,
"%skyc-proof/%s",
ps->exchange_base_url,
pd->section);
redirect_uri_encoded = TALER_urlencode (redirect_uri);
GNUNET_free (redirect_uri);
GNUNET_assert (NULL != redirect_uri_encoded);
client_id = curl_easy_escape (ph->eh,
pd->client_id,
0);
GNUNET_assert (NULL != client_id);
{
char *request_uri;
GNUNET_asprintf (&request_uri,
"%s?client_id=%s",
pd->login_url,
pd->client_id);
redirect_uri = curl_easy_escape (ph->eh,
request_uri,
0);
GNUNET_free (request_uri);
}
GNUNET_assert (NULL != redirect_uri);
client_secret = curl_easy_escape (ph->eh,
pd->client_secret,
0);
@ -1042,13 +1036,12 @@ oauth2_proof (void *cls,
GNUNET_asprintf (&ph->post_body,
"client_id=%s&redirect_uri=%s&client_secret=%s&code=%s&grant_type=authorization_code",
client_id,
redirect_uri_encoded,
redirect_uri,
client_secret,
authorization_code);
curl_free (authorization_code);
curl_free (client_secret);
curl_free (redirect_uri_encoded);
curl_free (hps);
curl_free (redirect_uri);
curl_free (client_id);
}
GNUNET_assert (CURLE_OK ==

View File

@ -747,14 +747,13 @@ persona_initiate (void *cls,
(unsigned long long) ih->legitimization_uuid);
payto_s = GNUNET_STRINGS_data_to_string_alloc (&ih->h_payto,
sizeof (ih->h_payto));
GNUNET_break ('/' ==
pd->ps->exchange_base_url[strlen (
pd->ps->exchange_base_url) - 1]);
/* NOTE: check here that exchange_base_url ends
with a '/'? */
GNUNET_asprintf (&proof_url,
"%skyc-proof/%s?state=%s",
"%skyc-proof/%s/%s",
pd->ps->exchange_base_url,
pd->section,
payto_s);
payto_s,
pd->section);
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_object_steal (
"data",
@ -1346,6 +1345,7 @@ handle_proof_finished (void *cls,
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param pd provider configuration details
* @param url_path rest of the URL after `/kyc-webhook/`
* @param connection MHD connection object (for HTTP headers)
* @param account_id which account to trigger process for
* @param process_row row in the legitimization processes table the legitimization is for
@ -1358,6 +1358,7 @@ handle_proof_finished (void *cls,
static struct TALER_KYCLOGIC_ProofHandle *
persona_proof (void *cls,
const struct TALER_KYCLOGIC_ProviderDetails *pd,
const char *const url_path[],
struct MHD_Connection *connection,
const struct TALER_PaytoHashP *account_id,
uint64_t process_row,

View File

@ -279,6 +279,7 @@ template_proof_cancel (struct TALER_KYCLOGIC_ProofHandle *ph)
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param pd provider configuration details
* @param url_path rest of the URL after `/kyc-webhook/`
* @param connection MHD connection object (for HTTP headers)
* @param account_id which account to trigger process for
* @param process_row row in the legitimization processes table the legitimization is for
@ -291,6 +292,7 @@ template_proof_cancel (struct TALER_KYCLOGIC_ProofHandle *ph)
static struct TALER_KYCLOGIC_ProofHandle *
template_proof (void *cls,
const struct TALER_KYCLOGIC_ProviderDetails *pd,
const char *const url_path[],
struct MHD_Connection *connection,
const struct TALER_PaytoHashP *account_id,
uint64_t process_row,
@ -302,6 +304,7 @@ template_proof (void *cls,
struct PluginState *ps = cls;
struct TALER_KYCLOGIC_ProofHandle *ph;
(void) url_path;
(void) account_id;
(void) process_row;
(void) provider_user_id;

View File

@ -727,42 +727,32 @@ proof_cb (
*
* @param rc request context
* @param args remaining URL arguments;
* args[0] should be the logic plugin name
* args[0] is the 'h_payto',
* args[1] should be the logic plugin name
*/
static MHD_RESULT
handler_kyc_proof_get (
struct TEKT_RequestContext *rc,
const char *const args[1])
const char *const args[])
{
struct TALER_PaytoHashP h_payto;
struct TALER_KYCLOGIC_ProviderDetails *pd;
struct TALER_KYCLOGIC_Plugin *logic;
struct ProofRequestState *rs;
const char *section_name;
const char *h_paytos;
if (NULL == args[0])
if ( (NULL == args[0]) ||
(NULL == args[1]) )
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
"'/kyc-proof/$PROVIDER_SECTION?state=$H_PAYTO' required");
}
h_paytos = MHD_lookup_connection_value (rc->connection,
MHD_GET_ARGUMENT_KIND,
"state");
if (NULL == h_paytos)
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MISSING,
"h_payto");
"'/$H_PAYTO/$LOGIC' required after '/kyc-proof'");
}
if (GNUNET_OK !=
GNUNET_STRINGS_string_to_data (h_paytos,
strlen (h_paytos),
GNUNET_STRINGS_string_to_data (args[0],
strlen (args[0]),
&h_payto,
sizeof (h_payto)))
{
@ -784,18 +774,18 @@ handler_kyc_proof_get (
}
if (GNUNET_OK !=
TALER_KYCLOGIC_lookup_logic (args[0],
TALER_KYCLOGIC_lookup_logic (args[1],
&logic,
&pd,
&section_name))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not initiate KYC with provider `%s' (configuration error?)\n",
args[0]);
args[1]);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_EXCHANGE_KYC_GENERIC_LOGIC_UNKNOWN,
args[0]);
args[1]);
}
rs = GNUNET_new (struct ProofRequestState);
rs->rc = rc;
@ -806,6 +796,7 @@ handler_kyc_proof_get (
rs);
rs->ph = logic->proof (logic->cls,
pd,
&args[2],
rc->connection,
&h_payto,
kyc_row_id,
@ -1041,7 +1032,8 @@ handle_mhd_request (void *cls,
.url = "kyc-proof",
.method = MHD_HTTP_METHOD_GET,
.handler.get = &handler_kyc_proof_get,
.nargs = 1
.nargs = 128,
.nargs_is_upper_bound = true
},
{
.url = "kyc-webhook",

View File

@ -154,7 +154,8 @@ TALER_EXCHANGE_kyc_proof (struct TALER_EXCHANGE_Handle *exchange,
if (NULL == args)
args = "";
else
GNUNET_assert (args[0] == '&');
GNUNET_assert ( (args[0] == '?') ||
(args[0] == '/') );
if (GNUNET_YES !=
TEAH_handle_is_ready (exchange))
{
@ -171,9 +172,9 @@ TALER_EXCHANGE_kyc_proof (struct TALER_EXCHANGE_Handle *exchange,
sizeof (hstr));
*end = '\0';
GNUNET_asprintf (&arg_str,
"/kyc-proof/%s?state=%s%s",
logic,
"/kyc-proof/%s/%s%s",
hstr,
logic,
args);
}
kph = GNUNET_new (struct TALER_EXCHANGE_KycProofHandle);

View File

@ -207,10 +207,10 @@ main (int argc,
with_libeufin = GNUNET_YES;
cfgfile = CONFIG_FILE_NEXUS;
if (GNUNET_OK !=
TALER_TESTING_prepare_libeufin (CONFIG_FILE_NEXUS,
GNUNET_YES,
"exchange-account-2",
&bc))
TALER_TESTING_prepare_nexus (CONFIG_FILE_NEXUS,
GNUNET_YES,
"exchange-account-2",
&bc))
{
GNUNET_break (0);
return 77;

View File

@ -131,6 +131,7 @@ run (void *cls,
"withdraw-coin-1-lacking-kyc",
"kyc-provider-test-oauth2",
"pass",
"state",
MHD_HTTP_SEE_OTHER),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1-with-kyc",
"create-reserve-1",
@ -174,6 +175,7 @@ run (void *cls,
"track-deposit-kyc-ready",
"kyc-provider-test-oauth2",
"bad",
"state",
MHD_HTTP_BAD_GATEWAY),
TALER_TESTING_cmd_oauth ("start-oauth-service",
6666),
@ -181,11 +183,13 @@ run (void *cls,
"track-deposit-kyc-ready",
"kyc-provider-test-oauth2",
"bad",
"state",
MHD_HTTP_FORBIDDEN),
TALER_TESTING_cmd_proof_kyc_oauth2 ("proof-kyc-fail",
"track-deposit-kyc-ready",
"kyc-provider-test-oauth2",
"pass",
"state",
MHD_HTTP_SEE_OTHER),
CMD_EXEC_AGGREGATOR ("run-aggregator-after-kyc"),
TALER_TESTING_cmd_check_bank_transfer (
@ -212,6 +216,7 @@ run (void *cls,
"wallet-kyc-fail",
"kyc-provider-test-oauth2",
"pass",
"state",
MHD_HTTP_SEE_OTHER),
TALER_TESTING_cmd_check_kyc_get ("wallet-kyc-check",
"wallet-kyc-fail",
@ -306,6 +311,7 @@ run (void *cls,
"purse-merge-into-reserve",
"kyc-provider-test-oauth2",
"pass",
"state",
MHD_HTTP_SEE_OTHER),
TALER_TESTING_cmd_purse_merge (
"purse-merge-into-reserve",
@ -347,6 +353,7 @@ run (void *cls,
"purse-create-with-reserve",
"kyc-provider-test-oauth2",
"pass",
"state",
MHD_HTTP_SEE_OTHER),
TALER_TESTING_cmd_purse_create_with_reserve (
"purse-create-with-reserve",

View File

@ -43,6 +43,11 @@ struct KycProofGetState
*/
const char *code;
/**
* State to pass.
*/
const char *state;
/**
* Logic section name to pass to `/kyc-proof/` handler.
*/
@ -153,12 +158,10 @@ proof_kyc_run (void *cls,
TALER_TESTING_interpreter_fail (kps->is);
return;
}
if (NULL == kps->code)
uargs = NULL;
else
GNUNET_asprintf (&uargs,
"&code=%s",
kps->code);
GNUNET_asprintf (&uargs,
"?code=%s&state=%s",
kps->code,
kps->state);
kps->kph = TALER_EXCHANGE_kyc_proof (is->exchange,
h_payto,
kps->logic,
@ -232,12 +235,14 @@ TALER_TESTING_cmd_proof_kyc_oauth2 (
const char *payment_target_reference,
const char *logic_section,
const char *code,
const char *state,
unsigned int expected_response_code)
{
struct KycProofGetState *kps;
kps = GNUNET_new (struct KycProofGetState);
kps->code = code;
kps->state = state;
kps->logic = logic_section;
kps->payment_target_reference = payment_target_reference;
kps->expected_response_code = expected_response_code;

View File

@ -1,6 +1,6 @@
/*
This file is part of TALER
Copyright (C) 2018-2023 Taler Systems SA
Copyright (C) 2018-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@ -92,10 +92,11 @@ TALER_TESTING_run_libeufin (const struct TALER_TESTING_BankConfiguration *bc)
struct TALER_TESTING_LibeufinServices ret = { 0 };
unsigned int iter;
char *curl_check_cmd;
const char *db_conn = "jdbc:sqlite:/tmp/libeufin-exchange-test.sqlite3";
setenv (
"LIBEUFIN_NEXUS_DB_CONNECTION",
"jdbc:sqlite:/tmp/libeufin-exchange-test-nexusdb.sqlite3",
db_conn,
1); // not overwriting any potentially existing DB.
nexus_proc = GNUNET_OS_start_process (
@ -145,8 +146,8 @@ TALER_TESTING_run_libeufin (const struct TALER_TESTING_BankConfiguration *bc)
fprintf (stderr, "\n");
setenv (
"LIBEUFIN_SANDBOX_DB_CONNECTION",
"jdbc:sqlite:/tmp/libeufin-exchange-test-sandboxdb.sqlite3",
1); // not overwriting any potentially existing DB.
db_conn,
1); // not overwriting existing any potentially existing DB.
setenv (
"LIBEUFIN_SANDBOX_ADMIN_PASSWORD",
"secret",
@ -298,10 +299,10 @@ TALER_TESTING_run_bank (const char *config_filename,
enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_libeufin (const char *config_filename,
bool reset_db,
const char *config_section,
struct TALER_TESTING_BankConfiguration *bc)
TALER_TESTING_prepare_nexus (const char *config_filename,
int reset_db,
const char *config_section,
struct TALER_TESTING_BankConfiguration *bc)
{
struct GNUNET_CONFIGURATION_Handle *cfg;
unsigned long long port;
@ -354,9 +355,9 @@ TALER_TESTING_prepare_libeufin (const char *config_filename,
GNUNET_NETWORK_test_port_free (IPPROTO_TCP,
(uint16_t) port))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Required port %llu not available, skipping.\n",
port);
fprintf (stderr,
"Required port %llu not available, skipping.\n",
port);
GNUNET_break (0);
GNUNET_free (database);
GNUNET_CONFIGURATION_destroy (cfg);
@ -364,20 +365,12 @@ TALER_TESTING_prepare_libeufin (const char *config_filename,
}
/* DB preparation */
if (reset_db)
if (GNUNET_YES == reset_db)
{
if (0 != system ("rm -f /tmp/libeufin-exchange-test-nexusdb.sqlite3"))
if (0 != system ("rm -f /tmp/libeufin-exchange-test.sqlite3"))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to invoke db-removal command on nexusdb.\n");
GNUNET_free (database);
GNUNET_CONFIGURATION_destroy (cfg);
return GNUNET_SYSERR;
}
if (0 != system ("rm -f /tmp/libeufin-exchange-test-sandboxdb.sqlite3"))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to invoke db-removal command on sandboxdb.\n");
"Failed to invoke db-removal command.\n");
GNUNET_free (database);
GNUNET_CONFIGURATION_destroy (cfg);
return GNUNET_SYSERR;
@ -414,14 +407,11 @@ TALER_TESTING_prepare_libeufin (const char *config_filename,
"Relying on nexus %s on port %u\n",
bc->exchange_auth.wire_gateway_url,
(unsigned int) port);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"exchange payto: %s\n",
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "exchange payto: %s\n",
bc->exchange_payto);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"user42_payto: %s\n",
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "user42_payto: %s\n",
bc->user42_payto);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"user42_payto: %s\n",
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "user42_payto: %s\n",
bc->user43_payto);
return GNUNET_OK;
}
@ -429,7 +419,7 @@ TALER_TESTING_prepare_libeufin (const char *config_filename,
enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_bank (const char *config_filename,
bool reset_db,
int reset_db,
const char *config_section,
struct TALER_TESTING_BankConfiguration *bc)
{
@ -501,9 +491,9 @@ TALER_TESTING_prepare_bank (const char *config_filename,
GNUNET_NETWORK_test_port_free (IPPROTO_TCP,
(uint16_t) port))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Required port %llu not available, skipping.\n",
port);
fprintf (stderr,
"Required port %llu not available, skipping.\n",
port);
GNUNET_break (0);
GNUNET_free (database);
GNUNET_CONFIGURATION_destroy (cfg);
@ -511,7 +501,7 @@ TALER_TESTING_prepare_bank (const char *config_filename,
}
/* DB preparation */
if (reset_db)
if (GNUNET_YES == reset_db)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Flushing bank database\n");