diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-11-01 08:49:17 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-11-05 10:37:37 +0100 |
commit | dffd755f96fc354c385e58d71e4f0b3594963b49 (patch) | |
tree | 2754edc57c142d23a0fbc22c9ef0ad0a0b81059b | |
parent | fc48ce87685f83f020e8808d3304ec1f97bec4bb (diff) |
-work on exchange
-rw-r--r-- | src/exchange/taler-exchange-httpd_keys.c | 6 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-check.c | 2 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-info.c | 4 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-proof.c | 2 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-start.c | 2 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-upload.c | 2 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-wallet.c | 40 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-webhook.c | 2 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_management_drain.c | 6 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_management_wire_disable.c | 6 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_management_wire_enable.c | 10 |
11 files changed, 45 insertions, 37 deletions
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index b861ad49d..40e14e115 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c @@ -677,7 +677,7 @@ TEH_wire_done () */ static void add_wire_account (void *cls, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -704,8 +704,8 @@ add_wire_account (void *cls, json_array_append_new ( a, GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("payto_uri", - payto_uri), + TALER_JSON_pack_full_payto ("payto_uri", + payto_uri), GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_string ("conversion_url", conversion_url)), diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c index 96b3d12f3..f51631f5f 100644 --- a/src/exchange/taler-exchange-httpd_kyc-check.c +++ b/src/exchange/taler-exchange-httpd_kyc-check.c @@ -63,7 +63,7 @@ struct KycPoller /** * Account for which we perform the KYC check. */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; /** * When will this request time out? diff --git a/src/exchange/taler-exchange-httpd_kyc-info.c b/src/exchange/taler-exchange-httpd_kyc-info.c index 9639dac95..857306479 100644 --- a/src/exchange/taler-exchange-httpd_kyc-info.c +++ b/src/exchange/taler-exchange-httpd_kyc-info.c @@ -86,7 +86,7 @@ struct KycPoller /** * Payto hash of the account matching @a access_token. */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; /** * True if we are still suspended. @@ -351,7 +351,7 @@ generate_reply (struct KycPoller *kyp, * @param jmeasures measures JSON object * @returns true if @a jmeasures contains an instant measure */ -bool +static bool contains_instant_measure (const json_t *jmeasures) { size_t i; diff --git a/src/exchange/taler-exchange-httpd_kyc-proof.c b/src/exchange/taler-exchange-httpd_kyc-proof.c index 1ba978a3a..6db1899a4 100644 --- a/src/exchange/taler-exchange-httpd_kyc-proof.c +++ b/src/exchange/taler-exchange-httpd_kyc-proof.c @@ -89,7 +89,7 @@ struct KycProofContext /** * Hash of payment target URI this is about. */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; /** * HTTP response to return. diff --git a/src/exchange/taler-exchange-httpd_kyc-start.c b/src/exchange/taler-exchange-httpd_kyc-start.c index f49f07e8a..7c032746e 100644 --- a/src/exchange/taler-exchange-httpd_kyc-start.c +++ b/src/exchange/taler-exchange-httpd_kyc-start.c @@ -53,7 +53,7 @@ struct KycPoller /** * Hash of the payto:// URI we are starting to the KYC for. */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; /** * Kept in a DLL. diff --git a/src/exchange/taler-exchange-httpd_kyc-upload.c b/src/exchange/taler-exchange-httpd_kyc-upload.c index 2841b94d0..b800dfe2a 100644 --- a/src/exchange/taler-exchange-httpd_kyc-upload.c +++ b/src/exchange/taler-exchange-httpd_kyc-upload.c @@ -455,7 +455,7 @@ TEH_handler_kyc_upload ( { uint64_t legi_process_row; - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; enum GNUNET_DB_QueryStatus qs; json_t *jmeasures; struct MHD_Response *empty_response; diff --git a/src/exchange/taler-exchange-httpd_kyc-wallet.c b/src/exchange/taler-exchange-httpd_kyc-wallet.c index de93c74ef..f89cd4a9c 100644 --- a/src/exchange/taler-exchange-httpd_kyc-wallet.c +++ b/src/exchange/taler-exchange-httpd_kyc-wallet.c @@ -56,7 +56,7 @@ struct KycRequestContext /** * Payto URI of the reserve. */ - char *payto_uri; + struct TALER_NormalizedPayto payto_uri; /** * Request context. @@ -74,7 +74,7 @@ struct KycRequestContext /** * Public key of the reserve/wallet this is about. */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; /** * The wallet's public key @@ -213,7 +213,7 @@ krc_cleaner (struct TEH_RequestContext *rc) TEH_legitimization_check_cancel (krc->lch); krc->lch = NULL; } - GNUNET_free (krc->payto_uri); + GNUNET_free (krc->payto_uri.normalized_payto); GNUNET_free (krc); } @@ -273,22 +273,30 @@ TEH_handler_kyc_wallet ( krc->payto_uri = TALER_reserve_make_payto (TEH_base_url, &krc->wallet_pub.reserve_pub); - TALER_payto_hash (krc->payto_uri, - &krc->h_payto); + TALER_normalized_payto_hash (krc->payto_uri, + &krc->h_payto); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "h_payto of wallet %s is %s\n", - krc->payto_uri, + krc->payto_uri.normalized_payto, TALER_B2S (&krc->h_payto)); - krc->lch = TEH_legitimization_check ( - &rc->async_scope_id, - TALER_KYCLOGIC_KYC_TRIGGER_WALLET_BALANCE, - krc->payto_uri, - &krc->h_payto, - &krc->wallet_pub, - &balance_iterator, - krc, - &legi_result_cb, - krc); + { + struct TALER_FullPayto fake_full_payto; + + GNUNET_asprintf (&fake_full_payto.full_payto, + "%s?receiver-name=wallet", + krc->payto_uri.normalized_payto); + krc->lch = TEH_legitimization_check ( + &rc->async_scope_id, + TALER_KYCLOGIC_KYC_TRIGGER_WALLET_BALANCE, + fake_full_payto, + &krc->h_payto, + &krc->wallet_pub, + &balance_iterator, + krc, + &legi_result_cb, + krc); + GNUNET_free (fake_full_payto.full_payto); + } GNUNET_assert (NULL != krc->lch); MHD_suspend_connection (rc->connection); GNUNET_CONTAINER_DLL_insert (krc_head, diff --git a/src/exchange/taler-exchange-httpd_kyc-webhook.c b/src/exchange/taler-exchange-httpd_kyc-webhook.c index 9cdcfb66b..af1e762c0 100644 --- a/src/exchange/taler-exchange-httpd_kyc-webhook.c +++ b/src/exchange/taler-exchange-httpd_kyc-webhook.c @@ -191,7 +191,7 @@ static void webhook_finished_cb ( void *cls, uint64_t process_row, - const struct TALER_PaytoHashP *account_id, + const struct TALER_NormalizedPaytoHashP *account_id, const char *provider_name, const char *provider_user_id, const char *provider_legitimization_id, diff --git a/src/exchange/taler-exchange-httpd_management_drain.c b/src/exchange/taler-exchange-httpd_management_drain.c index 1e490d799..1935d1082 100644 --- a/src/exchange/taler-exchange-httpd_management_drain.c +++ b/src/exchange/taler-exchange-httpd_management_drain.c @@ -50,7 +50,7 @@ struct DrainContext /** * Account to credit. */ - const char *payto_uri; + struct TALER_FullPayto payto_uri; /** * Configuration section with account to debit. @@ -124,8 +124,8 @@ TEH_handler_management_post_drain ( struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("debit_account_section", &dc.account_section), - TALER_JSON_spec_payto_uri ("credit_payto_uri", - &dc.payto_uri), + TALER_JSON_spec_full_payto_uri ("credit_payto_uri", + &dc.payto_uri), GNUNET_JSON_spec_fixed_auto ("wtid", &dc.wtid), GNUNET_JSON_spec_fixed_auto ("master_sig", diff --git a/src/exchange/taler-exchange-httpd_management_wire_disable.c b/src/exchange/taler-exchange-httpd_management_wire_disable.c index e0b8a3de8..4cd0eab07 100644 --- a/src/exchange/taler-exchange-httpd_management_wire_disable.c +++ b/src/exchange/taler-exchange-httpd_management_wire_disable.c @@ -45,7 +45,7 @@ struct DelWireContext /** * Payto:// URI this is about. */ - const char *payto_uri; + struct TALER_FullPayto payto_uri; /** * Timestamp for checking against replay attacks. @@ -146,8 +146,8 @@ TEH_handler_management_post_wire_disable ( struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("master_sig_del", &awc.master_sig), - TALER_JSON_spec_payto_uri ("payto_uri", - &awc.payto_uri), + TALER_JSON_spec_full_payto_uri ("payto_uri", + &awc.payto_uri), GNUNET_JSON_spec_timestamp ("validity_end", &awc.validity_end), GNUNET_JSON_spec_end () diff --git a/src/exchange/taler-exchange-httpd_management_wire_enable.c b/src/exchange/taler-exchange-httpd_management_wire_enable.c index 472e19d3e..799181221 100644 --- a/src/exchange/taler-exchange-httpd_management_wire_enable.c +++ b/src/exchange/taler-exchange-httpd_management_wire_enable.c @@ -52,7 +52,7 @@ struct AddWireContext /** * Payto:// URI this is about. */ - const char *payto_uri; + struct TALER_FullPayto payto_uri; /** * (optional) address of a conversion service for this account. @@ -185,8 +185,8 @@ TEH_handler_management_post_wire ( &awc.master_sig_wire), GNUNET_JSON_spec_fixed_auto ("master_sig_add", &awc.master_sig_add), - TALER_JSON_spec_payto_uri ("payto_uri", - &awc.payto_uri), + TALER_JSON_spec_full_payto_uri ("payto_uri", + &awc.payto_uri), GNUNET_JSON_spec_mark_optional ( TALER_JSON_spec_web_url ("conversion_url", &awc.conversion_url), @@ -277,12 +277,12 @@ TEH_handler_management_post_wire ( { char *wire_method; - wire_method = TALER_payto_get_method (awc.payto_uri); + wire_method = TALER_payto_get_method (awc.payto_uri.full_payto); if (NULL == wire_method) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "payto:// URI `%s' is malformed\n", - awc.payto_uri); + awc.payto_uri.full_payto); GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, |