diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-11-03 16:25:35 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-11-05 10:38:39 +0100 |
commit | a0d3621fbcb8861086b3e8cb9b88e588ac27c4d3 (patch) | |
tree | 4b18679f10774e46b5bd8e949497e122629da6fa /src/backend/taler-merchant-kyccheck.c | |
parent | 1c1650a665fab9fc133a7fe1c4c443ff7416e70c (diff) |
work on merchant
Diffstat (limited to 'src/backend/taler-merchant-kyccheck.c')
-rw-r--r-- | src/backend/taler-merchant-kyccheck.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/backend/taler-merchant-kyccheck.c b/src/backend/taler-merchant-kyccheck.c index 0ef9a353..fe4b5792 100644 --- a/src/backend/taler-merchant-kyccheck.c +++ b/src/backend/taler-merchant-kyccheck.c @@ -117,7 +117,7 @@ struct Account /** * The payto-URI of this account. */ - char *merchant_account_uri; + struct TALER_FullPayto merchant_account_uri; /** * Wire hash of the merchant bank account (with the @@ -133,7 +133,7 @@ struct Account /** * Hash of the @e merchant_account_uri. */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; /** * Database generation when this account @@ -483,7 +483,7 @@ exchange_check_cb ( i->last_ec = ks->hr.ec; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Checking KYC status of `%s' at `%s' is %u\n", - i->a->merchant_account_uri, + i->a->merchant_account_uri.full_payto, i->e->keys->exchange_url, ks->hr.http_status); switch (ks->hr.http_status) @@ -655,7 +655,7 @@ inquiry_work (void *cls) at_limit = false; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Checking KYC status of `%s' at `%s'\n", - i->a->merchant_account_uri, + i->a->merchant_account_uri.full_payto, i->e->keys->exchange_url); i->timeout = GNUNET_TIME_relative_to_absolute (EXCHANGE_TIMEOUT); @@ -713,6 +713,9 @@ static bool is_eligible (const struct TALER_EXCHANGE_Keys *keys, const struct Account *a) { + struct TALER_NormalizedPayto np; + + np = TALER_payto_normalize (a->merchant_account_uri); /* For all accounts of the exchange */ for (unsigned int i = 0; i<keys->accounts_len; i++) { @@ -727,11 +730,13 @@ is_eligible (const struct TALER_EXCHANGE_Keys *keys, if (GNUNET_YES != TALER_EXCHANGE_test_account_allowed (account, true, /* credit */ - a->merchant_account_uri)) + np)) continue; /* exchange account is allowed, add it */ + GNUNET_free (np.normalized_payto); return true; } + GNUNET_free (np.normalized_payto); return false; } @@ -911,7 +916,7 @@ account_cb ( const struct TALER_MerchantPrivateKeyP *merchant_priv, const struct TALER_MERCHANTDB_AccountDetails *ad) { - const char *payto_uri = ad->payto_uri; + struct TALER_FullPayto payto_uri = ad->payto_uri; if (! ad->active) return; @@ -922,8 +927,8 @@ account_cb ( a = a->next) { if (0 == - strcmp (payto_uri, - a->merchant_account_uri)) + TALER_full_payto_cmp (payto_uri, + a->merchant_account_uri)) { a->account_gen = database_gen; return; @@ -933,16 +938,16 @@ account_cb ( struct Account *a = GNUNET_new (struct Account); a->account_gen = database_gen; - a->merchant_account_uri - = GNUNET_strdup (ad->payto_uri); + a->merchant_account_uri.full_payto + = GNUNET_strdup (ad->payto_uri.full_payto); a->instance_id = GNUNET_strdup (ad->instance_id); a->h_wire = ad->h_wire; a->ap.merchant_priv = *merchant_priv; - TALER_payto_hash (a->merchant_account_uri, - &a->h_payto); + TALER_full_payto_normalize_and_hash (a->merchant_account_uri, + &a->h_payto); GNUNET_CONTAINER_DLL_insert (a_head, a_tail, @@ -1204,7 +1209,7 @@ rule_triggered (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Starting %skyc-check for `%s' due to KYC rule trigger\n", exchange_url, - i->a->merchant_account_uri); + i->a->merchant_account_uri.full_payto); i->task = GNUNET_SCHEDULER_add_at (i->due, &inquiry_work, i); @@ -1292,7 +1297,7 @@ shutdown_task (void *cls) GNUNET_CONTAINER_DLL_remove (a_head, a_tail, a); - GNUNET_free (a->merchant_account_uri); + GNUNET_free (a->merchant_account_uri.full_payto); GNUNET_free (a); } if (NULL != eh_accounts) |