diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-11-03 14:08:56 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-11-05 10:38:39 +0100 |
commit | 1c1650a665fab9fc133a7fe1c4c443ff7416e70c (patch) | |
tree | b49c1b5785115e34e8bd0005b7c7ced3dba5be9a /src/backend/taler-merchant-httpd_helper.c | |
parent | a3441d4981142648005254f9902e5918459eb542 (diff) |
work on merchant
Diffstat (limited to 'src/backend/taler-merchant-httpd_helper.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_helper.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/backend/taler-merchant-httpd_helper.c b/src/backend/taler-merchant-httpd_helper.c index 8fb5823e..5fc8eb3e 100644 --- a/src/backend/taler-merchant-httpd_helper.c +++ b/src/backend/taler-merchant-httpd_helper.c @@ -35,10 +35,10 @@ TMH_cmp_wire_account ( { const char *credit_facade_url = NULL; const json_t *credit_facade_credentials = NULL; - const char *uri; + struct TALER_FullPayto uri; struct GNUNET_JSON_Specification ispec[] = { - TALER_JSON_spec_payto_uri ("payto_uri", - &uri), + TALER_JSON_spec_full_payto_uri ("payto_uri", + &uri), GNUNET_JSON_spec_mark_optional ( TALER_JSON_spec_web_url ("credit_facade_url", &credit_facade_url), @@ -66,8 +66,8 @@ TMH_cmp_wire_account ( return GNUNET_SYSERR; } if (0 != - strcmp (wm->payto_uri, - uri)) + TALER_full_payto_cmp (wm->payto_uri, + uri)) { return GNUNET_SYSERR; } @@ -111,10 +111,10 @@ TMH_accounts_array_valid (const json_t *accounts) i); const char *credit_facade_url = NULL; const json_t *credit_facade_credentials = NULL; - const char *uri; + struct TALER_FullPayto uri; struct GNUNET_JSON_Specification ispec[] = { - TALER_JSON_spec_payto_uri ("payto_uri", - &uri), + TALER_JSON_spec_full_payto_uri ("payto_uri", + &uri), GNUNET_JSON_spec_mark_optional ( TALER_JSON_spec_web_url ("credit_facade_url", &credit_facade_url), @@ -147,7 +147,7 @@ TMH_accounts_array_valid (const json_t *accounts) { json_t *old_uri = json_array_get (accounts, j); - if (0 == strcmp (uri, + if (0 == strcmp (uri.full_payto, json_string_value ( json_object_get (old_uri, "payto_uri")))) @@ -164,7 +164,7 @@ TMH_accounts_array_valid (const json_t *accounts) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Encountered invalid payto://-URI `%s': %s\n", - uri, + uri.full_payto, err); GNUNET_free (err); return false; @@ -175,7 +175,7 @@ TMH_accounts_array_valid (const json_t *accounts) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "If credit_facade_url is given, credit_facade_credentials must also be specified (violated for %s)\n", - uri); + uri.full_payto); return false; } if ( (NULL != credit_facade_url) || @@ -490,7 +490,7 @@ TMH_taxes_array_valid (const json_t *taxes) struct TMH_WireMethod * TMH_setup_wire_account ( - const char *payto_uri, + struct TALER_FullPayto payto_uri, const char *credit_facade_url, const json_t *credit_facade_credentials) { @@ -501,7 +501,7 @@ TMH_setup_wire_account ( { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid URI `%s': %s\n", - payto_uri, + payto_uri.full_payto, emsg); GNUNET_free (emsg); return NULL; @@ -517,12 +517,13 @@ TMH_setup_wire_account ( GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, &wm->wire_salt, sizeof (wm->wire_salt)); - wm->payto_uri = GNUNET_strdup (payto_uri); + wm->payto_uri.full_payto + = GNUNET_strdup (payto_uri.full_payto); TALER_merchant_wire_signature_hash (payto_uri, &wm->wire_salt, &wm->h_wire); wm->wire_method - = TALER_payto_get_method (payto_uri); + = TALER_payto_get_method (payto_uri.full_payto); wm->active = true; return wm; } @@ -912,7 +913,7 @@ struct ExchangeMatchContext static void add_matching_account ( void *cls, - const char *payto_uri, + struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -921,7 +922,7 @@ add_matching_account ( struct ExchangeMatchContext *rc = cls; char *method; - method = TALER_payto_get_method (payto_uri); + method = TALER_payto_get_method (payto_uri.full_payto); if ( (NULL == rc->wire_method) || (0 == strcmp (method, rc->wire_method)) ) @@ -929,8 +930,8 @@ add_matching_account ( json_t *acc; acc = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("payto_uri", - payto_uri), + TALER_JSON_pack_full_payto ("payto_uri", + payto_uri), GNUNET_JSON_pack_data_auto ("master_sig", master_sig), GNUNET_JSON_pack_allow_null ( |