[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: -remove currency-based provider
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: -remove currency-based provider selection |
Date: |
Thu, 14 Apr 2022 18:59:43 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new 37cad4c -remove currency-based provider selection
37cad4c is described below
commit 37cad4c26b8c37ce12843965fcc9334e998923ab
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Apr 14 18:59:31 2022 +0200
-remove currency-based provider selection
---
contrib/Makefile.am | 1 -
contrib/provider-list.json | 14 +++---
contrib/redux.countries.json | 32 +-----------
contrib/redux.xx.json | 13 ++++-
contrib/redux.xy.json | 29 -----------
src/backend/anastasis-httpd.c | 22 ---------
src/backend/anastasis-httpd.h | 5 --
src/backend/anastasis-httpd_config.c | 2 -
src/backend/anastasis-httpd_policy-upload.c | 5 +-
src/backend/anastasis-httpd_truth-upload.c | 5 +-
src/include/anastasis_service.h | 5 --
src/reducer/anastasis_api_redux.c | 77 +++++++++--------------------
src/restclient/anastasis_api_config.c | 15 ------
13 files changed, 46 insertions(+), 179 deletions(-)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index fdd16d2..75bce03 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -64,7 +64,6 @@ pkgdata_DATA = \
redux.sk.json \
redux.us.json \
redux.xx.json \
- redux.xy.json \
redux.countries.json \
provider-list.json
diff --git a/contrib/provider-list.json b/contrib/provider-list.json
index 78b020d..b5ae514 100644
--- a/contrib/provider-list.json
+++ b/contrib/provider-list.json
@@ -3,28 +3,26 @@
"SPDX-License-Identifier": "GPL3.0-or-later",
"anastasis_provider": [
{
- "url" : "https://anastasis.demo.taler.net/",
- "currency" : "KUDOS"
+ "url" : "https://v1.anastasis.taler.net/"
},
{
- "url" : "https://kudos.demo.anastasis.lu/",
- "currency" : "KUDOS"
+ "url" : "https://v1.anastasis.lu/"
},
{
"url" : "http://localhost:8086/",
- "currency" : "TESTKUDOS"
+ "restricted" : "xx"
},
{
"url" : "http://localhost:8087/",
- "currency" : "TESTKUDOS"
+ "restricted" : "xx"
},
{
"url" : "http://localhost:8088/",
- "currency" : "TESTKUDOS"
+ "restricted" : "xx"
},
{
"url" : "http://localhost:8089/",
- "currency" : "TESTKUDOS"
+ "restricted" : "xx"
}
]
}
diff --git a/contrib/redux.countries.json b/contrib/redux.countries.json
index 61dec37..0d824fc 100644
--- a/contrib/redux.countries.json
+++ b/contrib/redux.countries.json
@@ -10,7 +10,6 @@
"de_DE": "Albanien",
"en_UK": "Albania"
},
- "currency": "ALL",
"call_code" : "+355"
},
{
@@ -21,7 +20,6 @@
"de_DE": "Belgien",
"en_UK": "Belgium"
},
- "currency": "EUR",
"call_code" : "+32"
},
{
@@ -34,7 +32,6 @@
"fr_FR": "Suisse",
"en_UK": "Swiss"
},
- "currency": "CHF",
"call_code" : "+41"
},
{
@@ -44,7 +41,6 @@
"name_i18n" : {
"en_UK": "Czech Republic"
},
- "currency": "CZK",
"call_code" : "+420"
},
{
@@ -58,7 +54,6 @@
"fr_FR": "Allemagne",
"en_UK": "Germany"
},
- "currency": "EUR",
"call_code" : "+49"
},
{
@@ -69,7 +64,6 @@
"name_i18n" : {
"en_UK": "Denmark"
},
- "currency": "DKK",
"call_code" : "+45"
},
{
@@ -80,7 +74,6 @@
"name_i18n" : {
"es_ES": "España"
},
- "currency": "EUR",
"call_code" : "+44"
},
{
@@ -91,7 +84,6 @@
"de_DE": "Frankreich",
"fr_FR": "La France"
},
- "currency": "EUR",
"call_code" : "+33"
},
{
@@ -105,7 +97,6 @@
"fr_FR": "l'Inde",
"en_UK": "India"
},
- "currency": "INR",
"call_code" : "+91"
},
{
@@ -116,7 +107,6 @@
"de_DE": "Italien",
"en_UK": "Italy"
},
- "currency": "EUR",
"call_code" : "+39"
},
{
@@ -129,7 +119,6 @@
"de_CH": "Japan",
"en_UK": "Japan"
},
- "currency": "JPY",
"call_code" : "+81"
},
{
@@ -141,7 +130,6 @@
"nl_NL": "Nederland",
"en_UK": "Netherlands"
},
- "currency": "EUR",
"call_code" : "+31"
},
{
@@ -151,7 +139,6 @@
"name_i18n" : {
"en_UK": "Slovakia"
},
- "currency": "EUR",
"call_code" : "+421"
},
{
@@ -165,36 +152,19 @@
"fr_FR": "États-Unis d'Amérique (USA)",
"en_UK": "United States of America (USA)"
},
- "currency": "USD",
"call_code" : "+1"
},
{
"code" : "xx",
"name" : "Testland",
- "continent" : "Testcontinent",
- "continent_i18n" : { "de_DE" : "Testkontinent" },
+ "continent" : "Demoworld",
"name_i18n" : {
"de_DE": "Testlandt",
"de_CH": "Testlandi",
"fr_FR": "Testpais",
"en_UK": "Testland"
},
- "currency": "TESTKUDOS",
"call_code" : "+00"
- },
- {
- "code" : "xy",
- "name" : "Demoland",
- "continent" : "Testcontinent",
- "continent_i18n" : { "de_DE" : "Testkontinent" },
- "name_i18n" : {
- "de_DE":"Demolandt",
- "de_CH":"Demolandi",
- "fr_FR": "Demopais",
- "en_UK": "Demoland"
- },
- "currency": "KUDOS",
- "call_code" : "+01"
}
]
}
diff --git a/contrib/redux.xx.json b/contrib/redux.xx.json
index b28af81..8e0fa72 100644
--- a/contrib/redux.xx.json
+++ b/contrib/redux.xx.json
@@ -1,6 +1,7 @@
{
"license": "GPLv3+",
"SPDX-License-Identifier": "GPL3.0-or-later",
+ "restricted" : "xx",
"required_attributes": [
{
"type": "string",
@@ -16,6 +17,15 @@
"widget": "anastasis_gtk_ia_birthdate",
"uuid" : "83d655c7-bdb6-484d-904e-80c1058c8854"
},
+ {
+ "type": "string",
+ "name": "prime_number",
+ "label": "Prime number",
+ "widget": "anastasis_gtk_xx_prime",
+ "uuid" : "39190a95-cacb-4412-8bae-1f7da3f980b4",
+ "validation-regex": "^[0-9]+$",
+ "validation-logic": "XY_PRIME_check"
+ },
{
"type": "string",
"name": "sq_number",
@@ -23,7 +33,8 @@
"widget": "anastasis_gtk_xx_square",
"uuid" : "ed790bca-89bf-11eb-96f2-233996cf644e",
"validation-regex": "^[0-9]+$",
- "validation-logic": "XX_SQUARE_check"
+ "validation-logic": "XX_SQUARE_check",
+ "optional" : true
}
]
}
diff --git a/contrib/redux.xy.json b/contrib/redux.xy.json
deleted file mode 100644
index 2091d9a..0000000
--- a/contrib/redux.xy.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "license": "GPLv3+",
- "SPDX-License-Identifier": "GPL3.0-or-later",
- "required_attributes": [
- {
- "type": "string",
- "name": "full_name",
- "label": "Full name",
- "widget": "anastasis_gtk_ia_full_name",
- "uuid" : "9e8f463f-575f-42cb-85f3-759559997331"
- },
- {
- "type": "date",
- "name": "birthdate",
- "label": "Birthdate",
- "widget": "anastasis_gtk_ia_birthdate",
- "uuid" : "83d655c7-bdb6-484d-904e-80c1058c8854"
- },
- {
- "type": "string",
- "name": "prime_number",
- "label": "Prime number",
- "widget": "anastasis_gtk_xx_prime",
- "uuid" : "39190a95-cacb-4412-8bae-1f7da3f980b4",
- "validation-regex": "^[0-9]+$",
- "validation-logic": "XY_PRIME_check"
- }
- ]
-}
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index 16e2a08..9b8c68e 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -72,11 +72,6 @@ const struct GNUNET_CONFIGURATION_Handle *AH_cfg;
*/
char *AH_backend_url;
-/**
- * Taler currency.
- */
-char *AH_currency;
-
/**
* Our fulfillment URL.
*/
@@ -760,23 +755,6 @@ run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
- if (GNUNET_OK !=
- TALER_config_get_currency (config,
- &AH_currency))
- {
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
- if (0 != strcasecmp (AH_currency,
- AH_annual_fee.currency))
- {
- GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
- "anastasis",
- "ANNUAL_FEE",
- "currency mismatch");
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
if (GNUNET_OK !=
TALER_amount_cmp_currency (&AH_insurance,
&AH_annual_fee))
diff --git a/src/backend/anastasis-httpd.h b/src/backend/anastasis-httpd.h
index 8cc96b2..1a87921 100644
--- a/src/backend/anastasis-httpd.h
+++ b/src/backend/anastasis-httpd.h
@@ -174,11 +174,6 @@ extern struct TALER_Amount AH_question_cost;
*/
extern char *AH_backend_url;
-/**
- * Taler currency.
- */
-extern char *AH_currency;
-
/**
* Heap for processing timeouts of requests.
*/
diff --git a/src/backend/anastasis-httpd_config.c
b/src/backend/anastasis-httpd_config.c
index adabffb..015fd01 100644
--- a/src/backend/anastasis-httpd_config.c
+++ b/src/backend/anastasis-httpd_config.c
@@ -106,8 +106,6 @@ AH_handler_config (struct AH_RequestHandler *rh,
"0:0:0"),
GNUNET_JSON_pack_string ("business_name",
AH_business_name),
- GNUNET_JSON_pack_string ("currency",
- (char *) AH_currency),
GNUNET_JSON_pack_array_steal ("methods",
method_arr),
GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes",
diff --git a/src/backend/anastasis-httpd_policy-upload.c
b/src/backend/anastasis-httpd_policy-upload.c
index 32f0266..94a38bc 100644
--- a/src/backend/anastasis-httpd_policy-upload.c
+++ b/src/backend/anastasis-httpd_policy-upload.c
@@ -435,9 +435,8 @@ check_payment_cb (void *cls,
const json_t *contract;
struct TALER_Amount amount;
struct GNUNET_JSON_Specification cspec[] = {
- TALER_JSON_spec_amount ("amount",
- AH_currency,
- &amount),
+ TALER_JSON_spec_amount_any ("amount",
+ &amount),
GNUNET_JSON_spec_end ()
};
diff --git a/src/backend/anastasis-httpd_truth-upload.c
b/src/backend/anastasis-httpd_truth-upload.c
index 642f523..356dc36 100644
--- a/src/backend/anastasis-httpd_truth-upload.c
+++ b/src/backend/anastasis-httpd_truth-upload.c
@@ -321,9 +321,8 @@ check_payment_cb (void *cls,
const json_t *contract;
struct TALER_Amount amount;
struct GNUNET_JSON_Specification cspec[] = {
- TALER_JSON_spec_amount ("amount",
- AH_currency,
- &amount),
+ TALER_JSON_spec_amount_any ("amount",
+ &amount),
GNUNET_JSON_spec_end ()
};
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index 5e01aa5..ba55314 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -61,11 +61,6 @@ struct ANASTASIS_Config
*/
const char *business_name;
- /**
- * Currency used for payments by the server.
- */
- const char *currency;
-
/**
* Array of authorization methods supported by the server.
*/
diff --git a/src/reducer/anastasis_api_redux.c
b/src/reducer/anastasis_api_redux.c
index b9d18ab..5dde4c6 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -151,11 +151,6 @@ struct ConfigRequest
*/
char *business_name;
- /**
- * currency used by the anastasis backend.
- */
- char *currency;
-
/**
* Array of authorization methods supported by the server.
*/
@@ -366,7 +361,6 @@ free_config_request (struct ConfigRequest *cr)
ANASTASIS_config_cancel (cr->co);
if (NULL != cr->tt)
GNUNET_SCHEDULER_cancel (cr->tt);
- GNUNET_free (cr->currency);
GNUNET_free (cr->url);
GNUNET_free (cr->business_name);
for (unsigned int i = 0; i<cr->methods_length; i++)
@@ -533,8 +527,6 @@ notify_waiting (struct ConfigRequest *cr)
&cr->truth_upload_fee),
TALER_JSON_pack_amount ("liability_limit",
&cr->liability_limit),
- GNUNET_JSON_pack_string ("currency",
- cr->currency),
GNUNET_JSON_pack_string ("business_name",
cr->business_name),
GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes",
@@ -598,8 +590,6 @@ config_cb (void *cls,
else
{
cr->ec = TALER_EC_NONE;
- GNUNET_free (cr->currency);
- cr->currency = GNUNET_strdup (acfg->currency);
GNUNET_free (cr->business_name);
cr->business_name = GNUNET_strdup (acfg->business_name);
for (unsigned int i = 0; i<cr->methods_length; i++)
@@ -693,12 +683,12 @@ check_config (const char *url)
/**
* Begin asynchronous check for provider configurations.
*
- * @param currencies the currencies to initiate the provider checks for
+ * @param cc country code that was selected
* @param[in,out] state to set provider list for
* @return #TALER_EC_NONE on success
*/
static enum TALER_ErrorCode
-begin_provider_config_check (const json_t *currencies,
+begin_provider_config_check (const char *cc,
json_t *state)
{
if (NULL == provider_list)
@@ -746,12 +736,14 @@ begin_provider_config_check (const json_t *currencies,
json_array_foreach (provider_arr, index, provider)
{
const char *url;
- const char *cur;
+ const char *restricted = NULL;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("url",
&url),
- GNUNET_JSON_spec_string ("currency",
- &cur),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_string ("restricted",
+ &restricted),
+ NULL),
GNUNET_JSON_spec_end ()
};
json_t *prov;
@@ -765,27 +757,21 @@ begin_provider_config_check (const json_t *currencies,
json_decref (pl);
return TALER_EC_ANASTASIS_REDUCER_RESOURCE_MALFORMED;
}
-
+ if ( (NULL != restricted) &&
+ (0 != strcmp (restricted,
+ cc)) )
{
- bool found = false;
- json_t *cu;
- size_t off;
-
- json_array_foreach (currencies, off, cu)
- {
- const char *currency;
-
- currency = json_string_value (cu);
- if (NULL == currency)
- {
- json_decref (pl);
- return TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID;
- }
- found = (0 == strcasecmp (currency,
- cur));
- }
- if (! found)
- continue;
+ /* skip */
+ continue;
+ }
+ if ( (NULL == restricted) &&
+ (0 == strcmp (cc,
+ "xx")) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Running in demo mode, skipping unrestricted providers\n");
+ /* demo mode, skipping regular providers */
+ continue;
}
prov = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("status",
@@ -1023,7 +1009,6 @@ select_country (json_t *state,
{
const json_t *required_attrs;
const json_t *country_code;
- const json_t *currencies;
const json_t *redux_id_attr;
if (NULL == arguments)
@@ -1073,23 +1058,11 @@ select_country (json_t *state,
}
}
- currencies = json_object_get (arguments,
- "currencies");
- if ( (NULL == currencies) ||
- (! json_is_array (currencies)) )
- {
- ANASTASIS_redux_fail_ (cb,
- cb_cls,
- TALER_EC_ANASTASIS_REDUCER_STATE_INVALID,
- "'currencies' missing");
- return NULL;
- }
- /* We now have an idea of the currency, begin fetching
- provider /configs (we likely need them later) */
+ /* Begin fetching provider /configs (we likely need them later) */
{
enum TALER_ErrorCode ec;
- ec = begin_provider_config_check (currencies,
+ ec = begin_provider_config_check (json_string_value (country_code),
state);
if (TALER_EC_NONE != ec)
{
@@ -1127,10 +1100,6 @@ select_country (json_t *state,
json_object_set (state,
"selected_country",
(json_t *) country_code));
- GNUNET_assert (0 ==
- json_object_set (state,
- "currencies",
- (json_t *) currencies));
GNUNET_assert (0 ==
json_object_set (state,
"required_attributes",
diff --git a/src/restclient/anastasis_api_config.c
b/src/restclient/anastasis_api_config.c
index 08b6952..dab63f7 100644
--- a/src/restclient/anastasis_api_config.c
+++ b/src/restclient/anastasis_api_config.c
@@ -108,8 +108,6 @@ handle_config_finished (void *cls,
&acfg.business_name),
GNUNET_JSON_spec_string ("version",
&acfg.version),
- GNUNET_JSON_spec_string ("currency",
- &acfg.currency),
GNUNET_JSON_spec_json ("methods",
&methods),
GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes",
@@ -179,19 +177,6 @@ handle_config_finished (void *cls,
break;
}
}
- if ( (GNUNET_OK !=
- TALER_amount_cmp_currency (&acfg.liability_limit,
- &acfg.annual_fee)) ||
- (0 !=
- strcasecmp (acfg.currency,
- acfg.annual_fee.currency)) )
- {
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- response_code = 0;
- break;
- }
-
if (! json_is_array (methods))
{
GNUNET_break_op (0);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: -remove currency-based provider selection,
gnunet <=