diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c index adaa0c9e..0ccee818 100644 --- a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c +++ b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c @@ -102,7 +102,7 @@ struct ExchangeKycRequest /** * Our account's payto URI. */ - char *payto_uri; + struct TALER_FullPayto payto_uri; /** * Base URL of the exchange. @@ -332,7 +332,7 @@ kyc_context_cleanup (void *cls) if (NULL != ekr->keys) TALER_EXCHANGE_keys_decref (ekr->keys); GNUNET_free (ekr->exchange_url); - GNUNET_free (ekr->payto_uri); + GNUNET_free (ekr->payto_uri.full_payto); GNUNET_free (ekr); } if (NULL != kc->eh) @@ -525,7 +525,7 @@ ekr_expand_response (struct ExchangeKycRequest *ekr) json_array_append_new ( ekr->kc->kycs_data, GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ( + TALER_JSON_pack_full_payto ( "payto_uri", ekr->payto_uri), GNUNET_JSON_pack_data_auto ( @@ -586,7 +586,7 @@ ekr_finished (struct ExchangeKycRequest *ekr) if (NULL != ekr->keys) TALER_EXCHANGE_keys_decref (ekr->keys); GNUNET_free (ekr->exchange_url); - GNUNET_free (ekr->payto_uri); + GNUNET_free (ekr->payto_uri.full_payto); GNUNET_free (ekr); if (NULL != kc->exchange_pending_head) @@ -633,6 +633,7 @@ determine_eligible_accounts ( const struct TALER_EXCHANGE_Keys *keys = ekr->keys; struct TALER_Amount kyc_amount; char *merchant_pub_str; + struct TALER_NormalizedPayto np; ekr->pkaa = json_array (); GNUNET_assert (NULL != ekr->pkaa); @@ -659,12 +660,11 @@ determine_eligible_accounts ( &kc->mi->merchant_pub, sizeof (kc->mi->merchant_pub)); /* For all accounts of the exchange */ + np = TALER_payto_normalize (ekr->payto_uri); for (unsigned int i = 0; i<keys->accounts_len; i++) { const struct TALER_EXCHANGE_WireAccount *account = &keys->accounts[i]; - const char *exchange_account_payto - = account->payto_uri; /* KYC auth transfers are never supported with conversion */ if (NULL != account->conversion_url) @@ -673,10 +673,12 @@ determine_eligible_accounts ( if (GNUNET_YES != TALER_EXCHANGE_test_account_allowed (account, true, /* credit */ - ekr->payto_uri)) + np)) continue; /* exchange account is allowed, add it */ { + const char *exchange_account_payto + = account->fpayto_uri.full_payto; char *payto_kycauth; if (TALER_amount_is_zero (&kyc_amount)) @@ -707,6 +709,7 @@ determine_eligible_accounts ( GNUNET_free (payto_kycauth); } } + GNUNET_free (np.normalized_payto); GNUNET_free (merchant_pub_str); } @@ -749,7 +752,7 @@ kyc_with_exchange (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "KYC auth to `%s' impossible for merchant account `%s'\n", ekr->exchange_url, - ekr->payto_uri); + ekr->payto_uri.full_payto); ekr->kyc_auth_conflict = true; } } @@ -777,7 +780,7 @@ static void kyc_status_cb ( void *cls, const struct TALER_MerchantWireHashP *h_wire, - const char *payto_uri, + struct TALER_FullPayto payto_uri, const char *exchange_url, struct GNUNET_TIME_Timestamp last_check, bool kyc_ok, @@ -792,7 +795,7 @@ kyc_status_cb ( GNUNET_log (GNUNET_ERROR_TYPE_INFO, "KYC status for `%s' at `%s' is %u/%s/%s/%s\n", - payto_uri, + payto_uri.full_payto, exchange_url, last_http_status, kyc_ok ? "KYC OK" : "KYC NEEDED", @@ -825,7 +828,8 @@ kyc_status_cb ( ekr->jlimits = json_incref ((json_t *) jlimits); ekr->h_wire = *h_wire; ekr->exchange_url = GNUNET_strdup (exchange_url); - ekr->payto_uri = GNUNET_strdup (payto_uri); + ekr->payto_uri.full_payto + = GNUNET_strdup (payto_uri.full_payto); ekr->last_check = last_check; ekr->kyc_ok = kyc_ok; ekr->kc = kc; |