gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated: select country test


From: gnunet
Subject: [taler-anastasis] branch master updated: select country test
Date: Tue, 23 Feb 2021 10:35:27 +0100

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 5c8469d  select country test
5c8469d is described below

commit 5c8469df095282921e9c701d25bf45c3f8a19ee2
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Feb 23 10:35:24 2021 +0100

    select country test
---
 contrib/Makefile.am                              |   1 +
 contrib/redux.xx.json                            |  33 +++++
 src/cli/Makefile.am                              |   9 +-
 src/cli/resources/02-backup.json                 |  82 +++++++++++++
 src/cli/resources/02-recovery.json               |  82 +++++++++++++
 src/cli/test_anastasis_reducer_select_country.sh | 109 +++++++++--------
 src/reducer/anastasis_api_backup_redux.c         |  82 -------------
 src/reducer/anastasis_api_redux.c                | 146 +++++++++++++++++++++--
 8 files changed, 401 insertions(+), 143 deletions(-)

diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index cac4125..4d6d5df 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -15,6 +15,7 @@ pkgdata_DATA = \
   redux.ch.json \
   redux.de.json \
   redux.us.json \
+  redux.xx.json \
   redux.countries.json \
   provider-list.json \
   test_resources/test_reducer_stateBFSTATE \
diff --git a/contrib/redux.xx.json b/contrib/redux.xx.json
new file mode 100644
index 0000000..7e2901e
--- /dev/null
+++ b/contrib/redux.xx.json
@@ -0,0 +1,33 @@
+{
+    "required_attributes": [
+       {
+               "type": "string",
+               "name": "full_name",
+               "label": "Full name",
+               "label_i18n":{
+                       "de_DE":"Vollstaendiger Name",
+                       "de_CH":"Vollstaendiger Name"
+                       },
+               "widget": "anastasis_gtk_ia_full_name"
+       },
+       {
+           "type": "date",
+           "name": "birthdate",
+               "label": "Birthdate",
+           "label_i18n":{"de_CH":"Geburtsdatum"},
+           "widget": "anastasis_gtk_ia_birthdate"
+       },
+       {
+               "type": "string",
+               "name": "ahv_number",
+               "label": "AHV number",
+               "label_i18n":{
+                       "de_DE":"AHV-Nummer",
+                       "de_CH":"AHV-Nummer"
+                       },
+               "widget": "anastasis_gtk_ia_ahv",
+               "validation-regex": 
"^(756).[0-9]{4}.[0-9]{4}.[0-9]{2}|(756)[0-9]{10}$",
+               "validation-logic": "CH_AVH_check"
+       }
+       ]
+}
diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
index a483045..ad2f81f 100644
--- a/src/cli/Makefile.am
+++ b/src/cli/Makefile.am
@@ -32,8 +32,13 @@ EXTRA_DIST = \
   test_anastasis_reducer_1.conf \
   test_anastasis_reducer_2.conf \
   test_anastasis_reducer_3.conf \
-  test_anastasis_reducer_4.conf
-#  test_resources
+  test_anastasis_reducer_4.conf \
+  resources/00-backup.json \
+  resources/01-backup.json \
+  resources/02-backup.json \
+  resources/00-recovery.json \
+  resources/01-recovery.json \
+  resources/02-recovery.json
 
 anastasis_reducer_SOURCES = \
   anastasis-cli-redux.c
diff --git a/src/cli/resources/02-backup.json b/src/cli/resources/02-backup.json
new file mode 100644
index 0000000..b0fb871
--- /dev/null
+++ b/src/cli/resources/02-backup.json
@@ -0,0 +1,82 @@
+{
+  "continents": [
+    "Europe",
+    "North America",
+    "Testcontinent"
+  ],
+  "backup_state": "USER_ATTRIBUTES_COLLECTING",
+  "selected_continent": "Testcontinent",
+  "countries": [
+    {
+      "code": "xx",
+      "name": "Testland",
+      "continent": "Testcontinent",
+      "continent_i18n": {
+        "xx": "Testkontinent"
+      },
+      "name_i18n": {
+        "de_DE": "Testlandt",
+        "de_CH": "Testlandi",
+        "fr": "Testpais",
+        "en": "Testland"
+      },
+      "currency": "TESTKUDOS"
+    },
+    {
+      "code": "xy",
+      "name": "Demoland",
+      "continent": "Testcontinent",
+      "continent_i18n": {
+        "xx": "Testkontinent"
+      },
+      "name_i18n": {
+        "de_DE": "Demolandt",
+        "de_CH": "Demolandi",
+        "fr": "Demopais",
+        "en": "Demoland"
+      },
+      "currency": "KUDOS"
+    }
+  ],
+  "authentication_providers": {
+    "http://localhost:8086/": {},
+    "http://localhost:8087/": {},
+    "http://localhost:8088/": {},
+    "http://localhost:8089/": {}
+  },
+  "selected_country": "xx",
+  "currency": "TESTKUDOS",
+  "required_attributes": [
+    {
+      "type": "string",
+      "name": "full_name",
+      "label": "Full name",
+      "label_i18n": {
+        "de_DE": "Vollstaendiger Name",
+        "de_CH": "Vollstaendiger Name"
+      },
+      "widget": "anastasis_gtk_ia_full_name"
+    },
+    {
+      "type": "date",
+      "name": "birthdate",
+      "label": "Birthdate",
+      "label_i18n": {
+        "de_CH": "Geburtsdatum"
+      },
+      "widget": "anastasis_gtk_ia_birthdate"
+    },
+    {
+      "type": "string",
+      "name": "ahv_number",
+      "label": "AHV number",
+      "label_i18n": {
+        "de_DE": "AHV-Nummer",
+        "de_CH": "AHV-Nummer"
+      },
+      "widget": "anastasis_gtk_ia_ahv",
+      "validation-regex": "^(756).[0-9]{4}.[0-9]{4}.[0-9]{2}|(756)[0-9]{10}$",
+      "validation-logic": "CH_AVH_check"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/src/cli/resources/02-recovery.json 
b/src/cli/resources/02-recovery.json
new file mode 100644
index 0000000..2fa7449
--- /dev/null
+++ b/src/cli/resources/02-recovery.json
@@ -0,0 +1,82 @@
+{
+  "continents": [
+    "Europe",
+    "North America",
+    "Testcontinent"
+  ],
+  "recovery_state": "USER_ATTRIBUTES_COLLECTING",
+  "selected_continent": "Testcontinent",
+  "countries": [
+    {
+      "code": "xx",
+      "name": "Testland",
+      "continent": "Testcontinent",
+      "continent_i18n": {
+        "xx": "Testkontinent"
+      },
+      "name_i18n": {
+        "de_DE": "Testlandt",
+        "de_CH": "Testlandi",
+        "fr": "Testpais",
+        "en": "Testland"
+      },
+      "currency": "TESTKUDOS"
+    },
+    {
+      "code": "xy",
+      "name": "Demoland",
+      "continent": "Testcontinent",
+      "continent_i18n": {
+        "xx": "Testkontinent"
+      },
+      "name_i18n": {
+        "de_DE": "Demolandt",
+        "de_CH": "Demolandi",
+        "fr": "Demopais",
+        "en": "Demoland"
+      },
+      "currency": "KUDOS"
+    }
+  ],
+  "authentication_providers": {
+    "http://localhost:8086/": {},
+    "http://localhost:8087/": {},
+    "http://localhost:8088/": {},
+    "http://localhost:8089/": {}
+  },
+  "selected_country": "xx",
+  "currency": "TESTKUDOS",
+  "required_attributes": [
+    {
+      "type": "string",
+      "name": "full_name",
+      "label": "Full name",
+      "label_i18n": {
+        "de_DE": "Vollstaendiger Name",
+        "de_CH": "Vollstaendiger Name"
+      },
+      "widget": "anastasis_gtk_ia_full_name"
+    },
+    {
+      "type": "date",
+      "name": "birthdate",
+      "label": "Birthdate",
+      "label_i18n": {
+        "de_CH": "Geburtsdatum"
+      },
+      "widget": "anastasis_gtk_ia_birthdate"
+    },
+    {
+      "type": "string",
+      "name": "ahv_number",
+      "label": "AHV number",
+      "label_i18n": {
+        "de_DE": "AHV-Nummer",
+        "de_CH": "AHV-Nummer"
+      },
+      "widget": "anastasis_gtk_ia_ahv",
+      "validation-regex": "^(756).[0-9]{4}.[0-9]{4}.[0-9]{2}|(756)[0-9]{10}$",
+      "validation-logic": "CH_AVH_check"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/src/cli/test_anastasis_reducer_select_country.sh 
b/src/cli/test_anastasis_reducer_select_country.sh
index c033efd..cf70ee2 100755
--- a/src/cli/test_anastasis_reducer_select_country.sh
+++ b/src/cli/test_anastasis_reducer_select_country.sh
@@ -106,85 +106,94 @@ then
 fi
 echo " OK"
 
-# Test country selection in a backup state
-echo -n "Test country selection in a backup state ..."
-./anastasis-reducer -b $SFILE
-./anastasis-reducer -a '{"continent": "Europe"}' select_continent $SFILE $TFILE
-./anastasis-reducer -a \
-  '{"country": "Switzerland",
-    "country_code": "ch",
-    "currency":"TESTKUDOS"}' \
-  select_country $TFILE $UFILE
+# Test continent re-selection
+echo -n "Test continent re-selection ..."
+anastasis-reducer -a '{"continent": "Europe"}' select_continent 
resources/01-recovery.json $TFILE
 
-STATE=`jq -r -e .backup_state < $UFILE`
-if test "$STATE" != "USER_ATTRIBUTES_COLLECTING"
-then
-    exit_fail "Expected new state to be USER_ATTRIBUTES_COLLECTING, got $STATE"
-fi
+echo -n "."
 
-SELECTED_COUNTRY=`jq -r -e .selected_country < $UFILE`
-if test "$SELECTED_COUNTRY" != "ch"
+STATE=`jq -r -e .recovery_state < $TFILE`
+if test "$STATE" != "COUNTRY_SELECTING"
 then
-    exit_fail "Expected selected country to be ch, got $SELECTED_COUNTRY"
+    exit_fail "Expected new state to be COUNTRY_SELECTING, got $STATE"
 fi
 
-SELECTED_CURRENCY=`jq -r -e .currency < $UFILE`
-if test "$SELECTED_CURRENCY" != "TESTKUDOS"
-then
-    exit_fail "Expected selected currency to be TESTKUDOS, got 
$SELECTED_CURRENCY"
-fi
+echo -n "."
 
-REQ_ATTRIBUTES=`jq -r -e .required_attributes < $UFILE`
-if test "$REQ_ATTRIBUTES" == NULL
-then
-    exit_fail "Expected required attributes array not to be NULL"
-fi
+jq -e .countries[0] < $TFILE > /dev/null || exit_fail "Expected new state to 
include countries"
+jq -e .countries[0].code < $TFILE > /dev/null || exit_fail "Expected new state 
to include countries with code"
+jq -e .countries[0].continent < $TFILE > /dev/null || exit_fail "Expected new 
state to include countries with continent"
+jq -e .countries[0].name < $TFILE > /dev/null || exit_fail "Expected new state 
to include countries with name"
+jq -e .countries[0].currency < $TFILE > /dev/null || exit_fail "Expected new 
state to include countries with currency"
 
-AUTH_PROVIDERS=`jq -r -e .authentication_providers < $UFILE`
-if test "$AUTH_PROVIDERS" == NULL
+SELECTED_CONTINENT=`jq -r -e .selected_continent < $TFILE`
+if test "$SELECTED_CONTINENT" != "Europe"
 then
-    exit_fail "Expected authentication_providers array not to be NULL"
+    exit_fail "Expected selected continent to be 'Testcontinent', got 
$SELECTED_CONTINENT"
 fi
 
 echo " OK"
 
-# Test country selection in a recovery state
-echo -n "Test country selection in a recovery state ..."
-./anastasis-reducer -r $SFILE
-./anastasis-reducer -a '{"continent": "Europe"}' select_continent $SFILE $TFILE
-./anastasis-reducer -a '{"country": "Switzerland", "country_code": "ch", 
"currency":"TESTKUDOS"}' select_country $TFILE $SFILE
 
-STATE=`jq -r -e .recovery_state < $SFILE`
+echo -n "Test NX country selection ..."
+
+anastasis-reducer -a \
+  '{"country_code": "zz",
+    "currency":"EUR"}' \
+        select_country \
+        resources/01-backup.json $TFILE 2> /dev/null \
+        && exit_fail "Expected selection to fail. Check '$TFILE'"
+
+echo " OK"
+
+echo -n "Test invalid country selection for continent ..."
+
+anastasis-reducer -a \
+  '{"country_code": "de",
+    "currency":"EUR"}' \
+        select_country \
+        resources/01-backup.json $TFILE 2> /dev/null \
+        && exit_fail "Expected selection to fail. Check '$TFILE'"
+
+echo " OK"
+
+echo -n "Test country selection ..."
+
+anastasis-reducer -a \
+  '{"country_code": "xx",
+    "currency":"TESTKUDOS"}' \
+  select_country resources/01-backup.json $UFILE
+
+STATE=`jq -r -e .backup_state < $UFILE`
 if test "$STATE" != "USER_ATTRIBUTES_COLLECTING"
 then
-    exit_fail "Expected new state to be USER_ATTRIBUTES_COLLECTING, got $STATE"
+    exit_fail "Expected new state to be 'USER_ATTRIBUTES_COLLECTING', got 
'$STATE'"
 fi
-
-SELECTED_COUNTRY=`jq -r -e .selected_country < $SFILE`
-if test "$SELECTED_COUNTRY" != "ch"
+echo -n "."
+SELECTED_COUNTRY=`jq -r -e .selected_country < $UFILE`
+if test "$SELECTED_COUNTRY" != "xx"
 then
-    exit_fail "Expected selected country to be ch, got $SELECTED_COUNTRY"
+    exit_fail "Expected selected country to be 'xx', got '$SELECTED_COUNTRY'"
 fi
-
-SELECTED_CURRENCY=`jq -r -e .currency < $SFILE`
+echo -n "."
+SELECTED_CURRENCY=`jq -r -e .currency < $UFILE`
 if test "$SELECTED_CURRENCY" != "TESTKUDOS"
 then
-    exit_fail "Expected selected currency to be TESTKUDOS, got 
$SELECTED_CURRENCY"
+    exit_fail "Expected selected currency to be 'TESTKUDOS', got 
'$SELECTED_CURRENCY'"
 fi
-
-REQ_ATTRIBUTES=`jq -r -e .required_attributes < $SFILE`
+echo -n "."
+REQ_ATTRIBUTES=`jq -r -e .required_attributes < $UFILE`
 if test "$REQ_ATTRIBUTES" == NULL
 then
     exit_fail "Expected required attributes array not to be NULL"
 fi
-
-AUTH_PROVIDERS=`jq -r -e .authentication_providers < $SFILE`
+echo -n "."
+AUTH_PROVIDERS=`jq -r -e .authentication_providers < $UFILE`
 if test "$AUTH_PROVIDERS" == NULL
 then
     exit_fail "Expected authentication_providers array not to be NULL"
 fi
 
-echo "OK"
-
+echo " OK"
 
 exit 0
diff --git a/src/reducer/anastasis_api_backup_redux.c 
b/src/reducer/anastasis_api_backup_redux.c
index 79e1b7b..062d95b 100644
--- a/src/reducer/anastasis_api_backup_redux.c
+++ b/src/reducer/anastasis_api_backup_redux.c
@@ -100,83 +100,6 @@ ANASTASIS_backup_start (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
 }
 
 
-/**
- * DispatchHandler/Callback function which is called for a
- * "add_provider" action.  Adds another Anastasis provider
- * to the list of available providers for storing information.
- *
- * @param state state to operate on
- * @param arguments arguments with a provider URL to add
- * @param cb callback to call during/after operation
- * @param cb_cls callback closure
- */
-static struct ANASTASIS_ReduxAction *
-add_provider (json_t *state,
-              const json_t *arguments,
-              ANASTASIS_ActionCallback cb,
-              void *cb_cls)
-{
-  json_t *urls;
-  json_t *tlist;
-
-  tlist = json_object_get (state,
-                           "authentication_providers");
-  if (NULL == tlist)
-  {
-    tlist = json_object ();
-    GNUNET_assert (NULL != tlist);
-    GNUNET_assert (0 ==
-                   json_object_set_new (state,
-                                        "authentication_providers",
-                                        tlist));
-  }
-
-  if (NULL == arguments)
-  {
-    ANASTASIS_redux_fail_ (cb,
-                           cb_cls,
-                           TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID,
-                           "arguments missing");
-    return NULL;
-  }
-  urls = json_object_get (arguments,
-                          "urls");
-  if (NULL == urls)
-  {
-    ANASTASIS_redux_fail_ (cb,
-                           cb_cls,
-                           TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID,
-                           "'urls' missing");
-    return NULL;
-  }
-  {
-    size_t index;
-    json_t *url;
-
-    json_array_foreach (urls, index, url)
-    {
-      const char *url_str = json_string_value (url);
-
-      if (NULL == url_str)
-      {
-        ANASTASIS_redux_fail_ (cb,
-                               cb_cls,
-                               TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID,
-                               "'urls' must be strings");
-        return NULL;
-      }
-      GNUNET_assert (json_object_set_new (tlist,
-                                          url_str,
-                                          json_object ()));
-    }
-  }
-  return ANASTASIS_REDUX_backup_begin_ (state,
-                                        arguments,
-                                        cb,
-                                        cb_cls);
-}
-
-
 /**
  * DispatchHandler/Callback function which is called for a
  * "add_authentication" action.
@@ -2349,11 +2272,6 @@ ANASTASIS_backup_action_ (json_t *state,
     const char *backup_action;
     DispatchHandler fun;
   } dispatchers[] = {
-    {
-      ANASTASIS_BACKUP_STATE_AUTHENTICATIONS_EDITING,
-      "add_provider",
-      &add_provider
-    },
     {
       ANASTASIS_BACKUP_STATE_AUTHENTICATIONS_EDITING,
       "add_authentication",
diff --git a/src/reducer/anastasis_api_redux.c 
b/src/reducer/anastasis_api_redux.c
index dba516f..7fd20c9 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -659,10 +659,12 @@ check_config (const char *url)
  * Begin asynchronous check for provider configurations.
  *
  * @param currency the currency to initiate the provider checks for
+ * @param[in,out] state to set provider list for
  * @return #TALER_EC_NONE on success
  */
 static enum TALER_ErrorCode
-begin_provider_config_check (const char *currency)
+begin_provider_config_check (const char *currency,
+                             json_t *state)
 {
   if (NULL == provider_list)
   {
@@ -703,6 +705,9 @@ begin_provider_config_check (const char *currency)
     json_t *provider;
     const json_t *provider_arr = json_object_get (provider_list,
                                                   "anastasis_provider");
+    json_t *pl;
+
+    pl = json_object ();
     json_array_foreach (provider_arr, index, provider)
     {
       const char *url;
@@ -721,14 +726,23 @@ begin_provider_config_check (const char *currency)
                              NULL, NULL))
       {
         GNUNET_break (0);
+        json_decref (pl);
         return TALER_EC_ANASTASIS_REDUCER_RESOURCE_MALFORMED;
       }
 
       if (0 != strcasecmp (currency,
                            cur))
         continue;
+      GNUNET_assert (0 ==
+                     json_object_set_new (pl,
+                                          url,
+                                          json_object ()));
       check_config (url);
     }
+    GNUNET_assert (0 ==
+                   json_object_set_new (state,
+                                        "authentication_providers",
+                                        pl));
   }
   return TALER_EC_NONE;
 }
@@ -948,7 +962,7 @@ select_country (json_t *state,
                 void *cb_cls)
 {
   const json_t *required_attrs;
-  const json_t *country;
+  const json_t *country_code;
   const char *currency;
   const json_t *redux_id_attr;
 
@@ -960,9 +974,9 @@ select_country (json_t *state,
                            "arguments missing");
     return NULL;
   }
-  country = json_object_get (arguments,
-                             "country_code");
-  if (NULL == country)
+  country_code = json_object_get (arguments,
+                                  "country_code");
+  if (NULL == country_code)
   {
     ANASTASIS_redux_fail_ (cb,
                            cb_cls,
@@ -970,6 +984,35 @@ select_country (json_t *state,
                            "'country_code' missing");
     return NULL;
   }
+
+  {
+    json_t *countries = json_object_get (state,
+                                         "countries");
+    size_t index;
+    json_t *country;
+    bool found = false;
+
+    json_array_foreach (countries, index, country)
+    {
+      json_t *cc = json_object_get (country,
+                                    "code");
+      if (1 == json_equal (country_code,
+                           cc))
+      {
+        found = true;
+        break;
+      }
+    }
+    if (! found)
+    {
+      ANASTASIS_redux_fail_ (cb,
+                             cb_cls,
+                             TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID,
+                             "specified country not on selected continent");
+      return NULL;
+    }
+  }
+
   currency = json_string_value (json_object_get (arguments,
                                                  "currency"));
   if (NULL == currency)
@@ -985,7 +1028,8 @@ select_country (json_t *state,
   {
     enum TALER_ErrorCode ec;
 
-    ec = begin_provider_config_check (currency);
+    ec = begin_provider_config_check (currency,
+                                      state);
     if (TALER_EC_NONE != ec)
     {
       GNUNET_break (0);
@@ -996,14 +1040,14 @@ select_country (json_t *state,
       return NULL;
     }
   }
-  redux_id_attr = redux_id_attr_init (json_string_value (country));
+  redux_id_attr = redux_id_attr_init (json_string_value (country_code));
   if (NULL == redux_id_attr)
   {
     GNUNET_break (0);
     ANASTASIS_redux_fail_ (cb,
                            cb_cls,
                            TALER_EC_ANASTASIS_REDUCER_RESOURCE_MISSING,
-                           json_string_value (country));
+                           json_string_value (country_code));
     return NULL;
   }
   required_attrs = json_object_get (redux_id_attr,
@@ -1021,7 +1065,7 @@ select_country (json_t *state,
   GNUNET_assert (0 ==
                  json_object_set (state,
                                   "selected_country",
-                                  (json_t *) country));
+                                  (json_t *) country_code));
   GNUNET_assert (0 ==
                  json_object_set_new (state,
                                       "currency",
@@ -1030,6 +1074,9 @@ select_country (json_t *state,
                  json_object_set (state,
                                   "required_attributes",
                                   (json_t *) required_attrs));
+  cb (cb_cls,
+      TALER_EC_NONE,
+      state);
   return NULL;
 }
 
@@ -1271,6 +1318,82 @@ enter_user_attributes (json_t *state,
 }
 
 
+/**
+ * DispatchHandler/Callback function which is called for a
+ * "add_provider" action.  Adds another Anastasis provider
+ * to the list of available providers for storing information.
+ *
+ * @param state state to operate on
+ * @param arguments arguments with a provider URL to add
+ * @param cb callback to call during/after operation
+ * @param cb_cls callback closure
+ */
+static struct ANASTASIS_ReduxAction *
+add_provider (json_t *state,
+              const json_t *arguments,
+              ANASTASIS_ActionCallback cb,
+              void *cb_cls)
+{
+  json_t *urls;
+  json_t *tlist;
+
+  tlist = json_object_get (state,
+                           "authentication_providers");
+  if (NULL == tlist)
+  {
+    tlist = json_object ();
+    GNUNET_assert (NULL != tlist);
+    GNUNET_assert (0 ==
+                   json_object_set_new (state,
+                                        "authentication_providers",
+                                        tlist));
+  }
+  if (NULL == arguments)
+  {
+    ANASTASIS_redux_fail_ (cb,
+                           cb_cls,
+                           TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID,
+                           "arguments missing");
+    return NULL;
+  }
+  urls = json_object_get (arguments,
+                          "urls");
+  if (NULL == urls)
+  {
+    ANASTASIS_redux_fail_ (cb,
+                           cb_cls,
+                           TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID,
+                           "'urls' missing");
+    return NULL;
+  }
+  {
+    size_t index;
+    json_t *url;
+
+    json_array_foreach (urls, index, url)
+    {
+      const char *url_str = json_string_value (url);
+
+      if (NULL == url_str)
+      {
+        ANASTASIS_redux_fail_ (cb,
+                               cb_cls,
+                               TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID,
+                               "'urls' must be strings");
+        return NULL;
+      }
+      GNUNET_assert (json_object_set_new (tlist,
+                                          url_str,
+                                          json_object ()));
+    }
+  }
+  cb (cb_cls,
+      TALER_EC_NONE,
+      state);
+  return NULL;
+}
+
+
 struct ANASTASIS_ReduxAction *
 ANASTASIS_back_generic_decrement_ (json_t *state,
                                    const json_t *arguments,
@@ -1373,6 +1496,11 @@ ANASTASIS_redux_action (const json_t *state,
       "enter_user_attributes",
       &enter_user_attributes
     },
+    {
+      ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTING,
+      "add_provider",
+      &add_provider
+    },
     {
       ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTING,
       "back",

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]