diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-04-14 18:59:31 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-04-14 18:59:38 +0200 |
commit | 37cad4c26b8c37ce12843965fcc9334e998923ab (patch) | |
tree | d8bf2f1a526fa6d061587e2b49d0c40c2b4233b5 | |
parent | cfc7801cf630e4090c038269e63ef8742cfcc7e5 (diff) | |
download | anastasis-37cad4c26b8c37ce12843965fcc9334e998923ab.tar.gz anastasis-37cad4c26b8c37ce12843965fcc9334e998923ab.zip |
-remove currency-based provider selection
-rw-r--r-- | contrib/Makefile.am | 1 | ||||
-rw-r--r-- | contrib/provider-list.json | 14 | ||||
-rw-r--r-- | contrib/redux.countries.json | 32 | ||||
-rw-r--r-- | contrib/redux.xx.json | 13 | ||||
-rw-r--r-- | contrib/redux.xy.json | 29 | ||||
-rw-r--r-- | src/backend/anastasis-httpd.c | 22 | ||||
-rw-r--r-- | src/backend/anastasis-httpd.h | 5 | ||||
-rw-r--r-- | src/backend/anastasis-httpd_config.c | 2 | ||||
-rw-r--r-- | src/backend/anastasis-httpd_policy-upload.c | 5 | ||||
-rw-r--r-- | src/backend/anastasis-httpd_truth-upload.c | 5 | ||||
-rw-r--r-- | src/include/anastasis_service.h | 5 | ||||
-rw-r--r-- | src/reducer/anastasis_api_redux.c | 77 | ||||
-rw-r--r-- | 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 = \ | |||
64 | redux.sk.json \ | 64 | redux.sk.json \ |
65 | redux.us.json \ | 65 | redux.us.json \ |
66 | redux.xx.json \ | 66 | redux.xx.json \ |
67 | redux.xy.json \ | ||
68 | redux.countries.json \ | 67 | redux.countries.json \ |
69 | provider-list.json | 68 | provider-list.json |
70 | 69 | ||
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 @@ | |||
3 | "SPDX-License-Identifier": "GPL3.0-or-later", | 3 | "SPDX-License-Identifier": "GPL3.0-or-later", |
4 | "anastasis_provider": [ | 4 | "anastasis_provider": [ |
5 | { | 5 | { |
6 | "url" : "https://anastasis.demo.taler.net/", | 6 | "url" : "https://v1.anastasis.taler.net/" |
7 | "currency" : "KUDOS" | ||
8 | }, | 7 | }, |
9 | { | 8 | { |
10 | "url" : "https://kudos.demo.anastasis.lu/", | 9 | "url" : "https://v1.anastasis.lu/" |
11 | "currency" : "KUDOS" | ||
12 | }, | 10 | }, |
13 | { | 11 | { |
14 | "url" : "http://localhost:8086/", | 12 | "url" : "http://localhost:8086/", |
15 | "currency" : "TESTKUDOS" | 13 | "restricted" : "xx" |
16 | }, | 14 | }, |
17 | { | 15 | { |
18 | "url" : "http://localhost:8087/", | 16 | "url" : "http://localhost:8087/", |
19 | "currency" : "TESTKUDOS" | 17 | "restricted" : "xx" |
20 | }, | 18 | }, |
21 | { | 19 | { |
22 | "url" : "http://localhost:8088/", | 20 | "url" : "http://localhost:8088/", |
23 | "currency" : "TESTKUDOS" | 21 | "restricted" : "xx" |
24 | }, | 22 | }, |
25 | { | 23 | { |
26 | "url" : "http://localhost:8089/", | 24 | "url" : "http://localhost:8089/", |
27 | "currency" : "TESTKUDOS" | 25 | "restricted" : "xx" |
28 | } | 26 | } |
29 | ] | 27 | ] |
30 | } | 28 | } |
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 @@ | |||
10 | "de_DE": "Albanien", | 10 | "de_DE": "Albanien", |
11 | "en_UK": "Albania" | 11 | "en_UK": "Albania" |
12 | }, | 12 | }, |
13 | "currency": "ALL", | ||
14 | "call_code" : "+355" | 13 | "call_code" : "+355" |
15 | }, | 14 | }, |
16 | { | 15 | { |
@@ -21,7 +20,6 @@ | |||
21 | "de_DE": "Belgien", | 20 | "de_DE": "Belgien", |
22 | "en_UK": "Belgium" | 21 | "en_UK": "Belgium" |
23 | }, | 22 | }, |
24 | "currency": "EUR", | ||
25 | "call_code" : "+32" | 23 | "call_code" : "+32" |
26 | }, | 24 | }, |
27 | { | 25 | { |
@@ -34,7 +32,6 @@ | |||
34 | "fr_FR": "Suisse", | 32 | "fr_FR": "Suisse", |
35 | "en_UK": "Swiss" | 33 | "en_UK": "Swiss" |
36 | }, | 34 | }, |
37 | "currency": "CHF", | ||
38 | "call_code" : "+41" | 35 | "call_code" : "+41" |
39 | }, | 36 | }, |
40 | { | 37 | { |
@@ -44,7 +41,6 @@ | |||
44 | "name_i18n" : { | 41 | "name_i18n" : { |
45 | "en_UK": "Czech Republic" | 42 | "en_UK": "Czech Republic" |
46 | }, | 43 | }, |
47 | "currency": "CZK", | ||
48 | "call_code" : "+420" | 44 | "call_code" : "+420" |
49 | }, | 45 | }, |
50 | { | 46 | { |
@@ -58,7 +54,6 @@ | |||
58 | "fr_FR": "Allemagne", | 54 | "fr_FR": "Allemagne", |
59 | "en_UK": "Germany" | 55 | "en_UK": "Germany" |
60 | }, | 56 | }, |
61 | "currency": "EUR", | ||
62 | "call_code" : "+49" | 57 | "call_code" : "+49" |
63 | }, | 58 | }, |
64 | { | 59 | { |
@@ -69,7 +64,6 @@ | |||
69 | "name_i18n" : { | 64 | "name_i18n" : { |
70 | "en_UK": "Denmark" | 65 | "en_UK": "Denmark" |
71 | }, | 66 | }, |
72 | "currency": "DKK", | ||
73 | "call_code" : "+45" | 67 | "call_code" : "+45" |
74 | }, | 68 | }, |
75 | { | 69 | { |
@@ -80,7 +74,6 @@ | |||
80 | "name_i18n" : { | 74 | "name_i18n" : { |
81 | "es_ES": "España" | 75 | "es_ES": "España" |
82 | }, | 76 | }, |
83 | "currency": "EUR", | ||
84 | "call_code" : "+44" | 77 | "call_code" : "+44" |
85 | }, | 78 | }, |
86 | { | 79 | { |
@@ -91,7 +84,6 @@ | |||
91 | "de_DE": "Frankreich", | 84 | "de_DE": "Frankreich", |
92 | "fr_FR": "La France" | 85 | "fr_FR": "La France" |
93 | }, | 86 | }, |
94 | "currency": "EUR", | ||
95 | "call_code" : "+33" | 87 | "call_code" : "+33" |
96 | }, | 88 | }, |
97 | { | 89 | { |
@@ -105,7 +97,6 @@ | |||
105 | "fr_FR": "l'Inde", | 97 | "fr_FR": "l'Inde", |
106 | "en_UK": "India" | 98 | "en_UK": "India" |
107 | }, | 99 | }, |
108 | "currency": "INR", | ||
109 | "call_code" : "+91" | 100 | "call_code" : "+91" |
110 | }, | 101 | }, |
111 | { | 102 | { |
@@ -116,7 +107,6 @@ | |||
116 | "de_DE": "Italien", | 107 | "de_DE": "Italien", |
117 | "en_UK": "Italy" | 108 | "en_UK": "Italy" |
118 | }, | 109 | }, |
119 | "currency": "EUR", | ||
120 | "call_code" : "+39" | 110 | "call_code" : "+39" |
121 | }, | 111 | }, |
122 | { | 112 | { |
@@ -129,7 +119,6 @@ | |||
129 | "de_CH": "Japan", | 119 | "de_CH": "Japan", |
130 | "en_UK": "Japan" | 120 | "en_UK": "Japan" |
131 | }, | 121 | }, |
132 | "currency": "JPY", | ||
133 | "call_code" : "+81" | 122 | "call_code" : "+81" |
134 | }, | 123 | }, |
135 | { | 124 | { |
@@ -141,7 +130,6 @@ | |||
141 | "nl_NL": "Nederland", | 130 | "nl_NL": "Nederland", |
142 | "en_UK": "Netherlands" | 131 | "en_UK": "Netherlands" |
143 | }, | 132 | }, |
144 | "currency": "EUR", | ||
145 | "call_code" : "+31" | 133 | "call_code" : "+31" |
146 | }, | 134 | }, |
147 | { | 135 | { |
@@ -151,7 +139,6 @@ | |||
151 | "name_i18n" : { | 139 | "name_i18n" : { |
152 | "en_UK": "Slovakia" | 140 | "en_UK": "Slovakia" |
153 | }, | 141 | }, |
154 | "currency": "EUR", | ||
155 | "call_code" : "+421" | 142 | "call_code" : "+421" |
156 | }, | 143 | }, |
157 | { | 144 | { |
@@ -165,36 +152,19 @@ | |||
165 | "fr_FR": "États-Unis d'Amérique (USA)", | 152 | "fr_FR": "États-Unis d'Amérique (USA)", |
166 | "en_UK": "United States of America (USA)" | 153 | "en_UK": "United States of America (USA)" |
167 | }, | 154 | }, |
168 | "currency": "USD", | ||
169 | "call_code" : "+1" | 155 | "call_code" : "+1" |
170 | }, | 156 | }, |
171 | { | 157 | { |
172 | "code" : "xx", | 158 | "code" : "xx", |
173 | "name" : "Testland", | 159 | "name" : "Testland", |
174 | "continent" : "Testcontinent", | 160 | "continent" : "Demoworld", |
175 | "continent_i18n" : { "de_DE" : "Testkontinent" }, | ||
176 | "name_i18n" : { | 161 | "name_i18n" : { |
177 | "de_DE": "Testlandt", | 162 | "de_DE": "Testlandt", |
178 | "de_CH": "Testlandi", | 163 | "de_CH": "Testlandi", |
179 | "fr_FR": "Testpais", | 164 | "fr_FR": "Testpais", |
180 | "en_UK": "Testland" | 165 | "en_UK": "Testland" |
181 | }, | 166 | }, |
182 | "currency": "TESTKUDOS", | ||
183 | "call_code" : "+00" | 167 | "call_code" : "+00" |
184 | }, | ||
185 | { | ||
186 | "code" : "xy", | ||
187 | "name" : "Demoland", | ||
188 | "continent" : "Testcontinent", | ||
189 | "continent_i18n" : { "de_DE" : "Testkontinent" }, | ||
190 | "name_i18n" : { | ||
191 | "de_DE":"Demolandt", | ||
192 | "de_CH":"Demolandi", | ||
193 | "fr_FR": "Demopais", | ||
194 | "en_UK": "Demoland" | ||
195 | }, | ||
196 | "currency": "KUDOS", | ||
197 | "call_code" : "+01" | ||
198 | } | 168 | } |
199 | ] | 169 | ] |
200 | } | 170 | } |
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 @@ | |||
1 | { | 1 | { |
2 | "license": "GPLv3+", | 2 | "license": "GPLv3+", |
3 | "SPDX-License-Identifier": "GPL3.0-or-later", | 3 | "SPDX-License-Identifier": "GPL3.0-or-later", |
4 | "restricted" : "xx", | ||
4 | "required_attributes": [ | 5 | "required_attributes": [ |
5 | { | 6 | { |
6 | "type": "string", | 7 | "type": "string", |
@@ -18,12 +19,22 @@ | |||
18 | }, | 19 | }, |
19 | { | 20 | { |
20 | "type": "string", | 21 | "type": "string", |
22 | "name": "prime_number", | ||
23 | "label": "Prime number", | ||
24 | "widget": "anastasis_gtk_xx_prime", | ||
25 | "uuid" : "39190a95-cacb-4412-8bae-1f7da3f980b4", | ||
26 | "validation-regex": "^[0-9]+$", | ||
27 | "validation-logic": "XY_PRIME_check" | ||
28 | }, | ||
29 | { | ||
30 | "type": "string", | ||
21 | "name": "sq_number", | 31 | "name": "sq_number", |
22 | "label": "Square number", | 32 | "label": "Square number", |
23 | "widget": "anastasis_gtk_xx_square", | 33 | "widget": "anastasis_gtk_xx_square", |
24 | "uuid" : "ed790bca-89bf-11eb-96f2-233996cf644e", | 34 | "uuid" : "ed790bca-89bf-11eb-96f2-233996cf644e", |
25 | "validation-regex": "^[0-9]+$", | 35 | "validation-regex": "^[0-9]+$", |
26 | "validation-logic": "XX_SQUARE_check" | 36 | "validation-logic": "XX_SQUARE_check", |
37 | "optional" : true | ||
27 | } | 38 | } |
28 | ] | 39 | ] |
29 | } | 40 | } |
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 @@ | |||
1 | { | ||
2 | "license": "GPLv3+", | ||
3 | "SPDX-License-Identifier": "GPL3.0-or-later", | ||
4 | "required_attributes": [ | ||
5 | { | ||
6 | "type": "string", | ||
7 | "name": "full_name", | ||
8 | "label": "Full name", | ||
9 | "widget": "anastasis_gtk_ia_full_name", | ||
10 | "uuid" : "9e8f463f-575f-42cb-85f3-759559997331" | ||
11 | }, | ||
12 | { | ||
13 | "type": "date", | ||
14 | "name": "birthdate", | ||
15 | "label": "Birthdate", | ||
16 | "widget": "anastasis_gtk_ia_birthdate", | ||
17 | "uuid" : "83d655c7-bdb6-484d-904e-80c1058c8854" | ||
18 | }, | ||
19 | { | ||
20 | "type": "string", | ||
21 | "name": "prime_number", | ||
22 | "label": "Prime number", | ||
23 | "widget": "anastasis_gtk_xx_prime", | ||
24 | "uuid" : "39190a95-cacb-4412-8bae-1f7da3f980b4", | ||
25 | "validation-regex": "^[0-9]+$", | ||
26 | "validation-logic": "XY_PRIME_check" | ||
27 | } | ||
28 | ] | ||
29 | } | ||
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 | |||
@@ -73,11 +73,6 @@ const struct GNUNET_CONFIGURATION_Handle *AH_cfg; | |||
73 | char *AH_backend_url; | 73 | char *AH_backend_url; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Taler currency. | ||
77 | */ | ||
78 | char *AH_currency; | ||
79 | |||
80 | /** | ||
81 | * Our fulfillment URL. | 76 | * Our fulfillment URL. |
82 | */ | 77 | */ |
83 | char *AH_fulfillment_url; | 78 | char *AH_fulfillment_url; |
@@ -761,23 +756,6 @@ run (void *cls, | |||
761 | return; | 756 | return; |
762 | } | 757 | } |
763 | if (GNUNET_OK != | 758 | if (GNUNET_OK != |
764 | TALER_config_get_currency (config, | ||
765 | &AH_currency)) | ||
766 | { | ||
767 | GNUNET_SCHEDULER_shutdown (); | ||
768 | return; | ||
769 | } | ||
770 | if (0 != strcasecmp (AH_currency, | ||
771 | AH_annual_fee.currency)) | ||
772 | { | ||
773 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | ||
774 | "anastasis", | ||
775 | "ANNUAL_FEE", | ||
776 | "currency mismatch"); | ||
777 | GNUNET_SCHEDULER_shutdown (); | ||
778 | return; | ||
779 | } | ||
780 | if (GNUNET_OK != | ||
781 | TALER_amount_cmp_currency (&AH_insurance, | 759 | TALER_amount_cmp_currency (&AH_insurance, |
782 | &AH_annual_fee)) | 760 | &AH_annual_fee)) |
783 | { | 761 | { |
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 | |||
@@ -175,11 +175,6 @@ extern struct TALER_Amount AH_question_cost; | |||
175 | extern char *AH_backend_url; | 175 | extern char *AH_backend_url; |
176 | 176 | ||
177 | /** | 177 | /** |
178 | * Taler currency. | ||
179 | */ | ||
180 | extern char *AH_currency; | ||
181 | |||
182 | /** | ||
183 | * Heap for processing timeouts of requests. | 178 | * Heap for processing timeouts of requests. |
184 | */ | 179 | */ |
185 | extern struct GNUNET_CONTAINER_Heap *AH_to_heap; | 180 | extern struct GNUNET_CONTAINER_Heap *AH_to_heap; |
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, | |||
106 | "0:0:0"), | 106 | "0:0:0"), |
107 | GNUNET_JSON_pack_string ("business_name", | 107 | GNUNET_JSON_pack_string ("business_name", |
108 | AH_business_name), | 108 | AH_business_name), |
109 | GNUNET_JSON_pack_string ("currency", | ||
110 | (char *) AH_currency), | ||
111 | GNUNET_JSON_pack_array_steal ("methods", | 109 | GNUNET_JSON_pack_array_steal ("methods", |
112 | method_arr), | 110 | method_arr), |
113 | GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes", | 111 | 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, | |||
435 | const json_t *contract; | 435 | const json_t *contract; |
436 | struct TALER_Amount amount; | 436 | struct TALER_Amount amount; |
437 | struct GNUNET_JSON_Specification cspec[] = { | 437 | struct GNUNET_JSON_Specification cspec[] = { |
438 | TALER_JSON_spec_amount ("amount", | 438 | TALER_JSON_spec_amount_any ("amount", |
439 | AH_currency, | 439 | &amount), |
440 | &amount), | ||
441 | GNUNET_JSON_spec_end () | 440 | GNUNET_JSON_spec_end () |
442 | }; | 441 | }; |
443 | 442 | ||
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, | |||
321 | const json_t *contract; | 321 | const json_t *contract; |
322 | struct TALER_Amount amount; | 322 | struct TALER_Amount amount; |
323 | struct GNUNET_JSON_Specification cspec[] = { | 323 | struct GNUNET_JSON_Specification cspec[] = { |
324 | TALER_JSON_spec_amount ("amount", | 324 | TALER_JSON_spec_amount_any ("amount", |
325 | AH_currency, | 325 | &amount), |
326 | &amount), | ||
327 | GNUNET_JSON_spec_end () | 326 | GNUNET_JSON_spec_end () |
328 | }; | 327 | }; |
329 | 328 | ||
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 | |||
@@ -62,11 +62,6 @@ struct ANASTASIS_Config | |||
62 | const char *business_name; | 62 | const char *business_name; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Currency used for payments by the server. | ||
66 | */ | ||
67 | const char *currency; | ||
68 | |||
69 | /** | ||
70 | * Array of authorization methods supported by the server. | 65 | * Array of authorization methods supported by the server. |
71 | */ | 66 | */ |
72 | const struct ANASTASIS_AuthorizationMethodConfig *methods; | 67 | const struct ANASTASIS_AuthorizationMethodConfig *methods; |
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 | |||
@@ -152,11 +152,6 @@ struct ConfigRequest | |||
152 | char *business_name; | 152 | char *business_name; |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * currency used by the anastasis backend. | ||
156 | */ | ||
157 | char *currency; | ||
158 | |||
159 | /** | ||
160 | * Array of authorization methods supported by the server. | 155 | * Array of authorization methods supported by the server. |
161 | */ | 156 | */ |
162 | struct AuthorizationMethodConfig *methods; | 157 | struct AuthorizationMethodConfig *methods; |
@@ -366,7 +361,6 @@ free_config_request (struct ConfigRequest *cr) | |||
366 | ANASTASIS_config_cancel (cr->co); | 361 | ANASTASIS_config_cancel (cr->co); |
367 | if (NULL != cr->tt) | 362 | if (NULL != cr->tt) |
368 | GNUNET_SCHEDULER_cancel (cr->tt); | 363 | GNUNET_SCHEDULER_cancel (cr->tt); |
369 | GNUNET_free (cr->currency); | ||
370 | GNUNET_free (cr->url); | 364 | GNUNET_free (cr->url); |
371 | GNUNET_free (cr->business_name); | 365 | GNUNET_free (cr->business_name); |
372 | for (unsigned int i = 0; i<cr->methods_length; i++) | 366 | for (unsigned int i = 0; i<cr->methods_length; i++) |
@@ -533,8 +527,6 @@ notify_waiting (struct ConfigRequest *cr) | |||
533 | &cr->truth_upload_fee), | 527 | &cr->truth_upload_fee), |
534 | TALER_JSON_pack_amount ("liability_limit", | 528 | TALER_JSON_pack_amount ("liability_limit", |
535 | &cr->liability_limit), | 529 | &cr->liability_limit), |
536 | GNUNET_JSON_pack_string ("currency", | ||
537 | cr->currency), | ||
538 | GNUNET_JSON_pack_string ("business_name", | 530 | GNUNET_JSON_pack_string ("business_name", |
539 | cr->business_name), | 531 | cr->business_name), |
540 | GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes", | 532 | GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes", |
@@ -598,8 +590,6 @@ config_cb (void *cls, | |||
598 | else | 590 | else |
599 | { | 591 | { |
600 | cr->ec = TALER_EC_NONE; | 592 | cr->ec = TALER_EC_NONE; |
601 | GNUNET_free (cr->currency); | ||
602 | cr->currency = GNUNET_strdup (acfg->currency); | ||
603 | GNUNET_free (cr->business_name); | 593 | GNUNET_free (cr->business_name); |
604 | cr->business_name = GNUNET_strdup (acfg->business_name); | 594 | cr->business_name = GNUNET_strdup (acfg->business_name); |
605 | for (unsigned int i = 0; i<cr->methods_length; i++) | 595 | for (unsigned int i = 0; i<cr->methods_length; i++) |
@@ -693,12 +683,12 @@ check_config (const char *url) | |||
693 | /** | 683 | /** |
694 | * Begin asynchronous check for provider configurations. | 684 | * Begin asynchronous check for provider configurations. |
695 | * | 685 | * |
696 | * @param currencies the currencies to initiate the provider checks for | 686 | * @param cc country code that was selected |
697 | * @param[in,out] state to set provider list for | 687 | * @param[in,out] state to set provider list for |
698 | * @return #TALER_EC_NONE on success | 688 | * @return #TALER_EC_NONE on success |
699 | */ | 689 | */ |
700 | static enum TALER_ErrorCode | 690 | static enum TALER_ErrorCode |
701 | begin_provider_config_check (const json_t *currencies, | 691 | begin_provider_config_check (const char *cc, |
702 | json_t *state) | 692 | json_t *state) |
703 | { | 693 | { |
704 | if (NULL == provider_list) | 694 | if (NULL == provider_list) |
@@ -746,12 +736,14 @@ begin_provider_config_check (const json_t *currencies, | |||
746 | json_array_foreach (provider_arr, index, provider) | 736 | json_array_foreach (provider_arr, index, provider) |
747 | { | 737 | { |
748 | const char *url; | 738 | const char *url; |
749 | const char *cur; | 739 | const char *restricted = NULL; |
750 | struct GNUNET_JSON_Specification spec[] = { | 740 | struct GNUNET_JSON_Specification spec[] = { |
751 | GNUNET_JSON_spec_string ("url", | 741 | GNUNET_JSON_spec_string ("url", |
752 | &url), | 742 | &url), |
753 | GNUNET_JSON_spec_string ("currency", | 743 | GNUNET_JSON_spec_mark_optional ( |
754 | &cur), | 744 | GNUNET_JSON_spec_string ("restricted", |
745 | &restricted), | ||
746 | NULL), | ||
755 | GNUNET_JSON_spec_end () | 747 | GNUNET_JSON_spec_end () |
756 | }; | 748 | }; |
757 | json_t *prov; | 749 | json_t *prov; |
@@ -765,27 +757,21 @@ begin_provider_config_check (const json_t *currencies, | |||
765 | json_decref (pl); | 757 | json_decref (pl); |
766 | return TALER_EC_ANASTASIS_REDUCER_RESOURCE_MALFORMED; | 758 | return TALER_EC_ANASTASIS_REDUCER_RESOURCE_MALFORMED; |
767 | } | 759 | } |
768 | 760 | if ( (NULL != restricted) && | |
761 | (0 != strcmp (restricted, | ||
762 | cc)) ) | ||
769 | { | 763 | { |
770 | bool found = false; | 764 | /* skip */ |
771 | json_t *cu; | 765 | continue; |
772 | size_t off; | 766 | } |
773 | 767 | if ( (NULL == restricted) && | |
774 | json_array_foreach (currencies, off, cu) | 768 | (0 == strcmp (cc, |
775 | { | 769 | "xx")) ) |
776 | const char *currency; | 770 | { |
777 | 771 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | |
778 | currency = json_string_value (cu); | 772 | "Running in demo mode, skipping unrestricted providers\n"); |
779 | if (NULL == currency) | 773 | /* demo mode, skipping regular providers */ |
780 | { | 774 | continue; |
781 | json_decref (pl); | ||
782 | return TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID; | ||
783 | } | ||
784 | found = (0 == strcasecmp (currency, | ||
785 | cur)); | ||
786 | } | ||
787 | if (! found) | ||
788 | continue; | ||
789 | } | 775 | } |
790 | prov = GNUNET_JSON_PACK ( | 776 | prov = GNUNET_JSON_PACK ( |
791 | GNUNET_JSON_pack_string ("status", | 777 | GNUNET_JSON_pack_string ("status", |
@@ -1023,7 +1009,6 @@ select_country (json_t *state, | |||
1023 | { | 1009 | { |
1024 | const json_t *required_attrs; | 1010 | const json_t *required_attrs; |
1025 | const json_t *country_code; | 1011 | const json_t *country_code; |
1026 | const json_t *currencies; | ||
1027 | const json_t *redux_id_attr; | 1012 | const json_t *redux_id_attr; |
1028 | 1013 | ||
1029 | if (NULL == arguments) | 1014 | if (NULL == arguments) |
@@ -1073,23 +1058,11 @@ select_country (json_t *state, | |||
1073 | } | 1058 | } |
1074 | } | 1059 | } |
1075 | 1060 | ||
1076 | currencies = json_object_get (arguments, | 1061 | /* Begin fetching provider /configs (we likely need them later) */ |
1077 | "currencies"); | ||
1078 | if ( (NULL == currencies) || | ||
1079 | (! json_is_array (currencies)) ) | ||
1080 | { | ||
1081 | ANASTASIS_redux_fail_ (cb, | ||
1082 | cb_cls, | ||
1083 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, | ||
1084 | "'currencies' missing"); | ||
1085 | return NULL; | ||
1086 | } | ||
1087 | /* We now have an idea of the currency, begin fetching | ||
1088 | provider /configs (we likely need them later) */ | ||
1089 | { | 1062 | { |
1090 | enum TALER_ErrorCode ec; | 1063 | enum TALER_ErrorCode ec; |
1091 | 1064 | ||
1092 | ec = begin_provider_config_check (currencies, | 1065 | ec = begin_provider_config_check (json_string_value (country_code), |
1093 | state); | 1066 | state); |
1094 | if (TALER_EC_NONE != ec) | 1067 | if (TALER_EC_NONE != ec) |
1095 | { | 1068 | { |
@@ -1129,10 +1102,6 @@ select_country (json_t *state, | |||
1129 | (json_t *) country_code)); | 1102 | (json_t *) country_code)); |
1130 | GNUNET_assert (0 == | 1103 | GNUNET_assert (0 == |
1131 | json_object_set (state, | 1104 | json_object_set (state, |
1132 | "currencies", | ||
1133 | (json_t *) currencies)); | ||
1134 | GNUNET_assert (0 == | ||
1135 | json_object_set (state, | ||
1136 | "required_attributes", | 1105 | "required_attributes", |
1137 | (json_t *) required_attrs)); | 1106 | (json_t *) required_attrs)); |
1138 | cb (cb_cls, | 1107 | cb (cb_cls, |
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, | |||
108 | &acfg.business_name), | 108 | &acfg.business_name), |
109 | GNUNET_JSON_spec_string ("version", | 109 | GNUNET_JSON_spec_string ("version", |
110 | &acfg.version), | 110 | &acfg.version), |
111 | GNUNET_JSON_spec_string ("currency", | ||
112 | &acfg.currency), | ||
113 | GNUNET_JSON_spec_json ("methods", | 111 | GNUNET_JSON_spec_json ("methods", |
114 | &methods), | 112 | &methods), |
115 | GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", | 113 | GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", |
@@ -179,19 +177,6 @@ handle_config_finished (void *cls, | |||
179 | break; | 177 | break; |
180 | } | 178 | } |
181 | } | 179 | } |
182 | if ( (GNUNET_OK != | ||
183 | TALER_amount_cmp_currency (&acfg.liability_limit, | ||
184 | &acfg.annual_fee)) || | ||
185 | (0 != | ||
186 | strcasecmp (acfg.currency, | ||
187 | acfg.annual_fee.currency)) ) | ||
188 | { | ||
189 | GNUNET_break_op (0); | ||
190 | GNUNET_JSON_parse_free (spec); | ||
191 | response_code = 0; | ||
192 | break; | ||
193 | } | ||
194 | |||
195 | if (! json_is_array (methods)) | 180 | if (! json_is_array (methods)) |
196 | { | 181 | { |
197 | GNUNET_break_op (0); | 182 | GNUNET_break_op (0); |