gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: expand country list


From: gnunet
Subject: [taler-anastasis] branch master updated: expand country list
Date: Sat, 03 Jul 2021 23:01:59 +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 d2e18b6  expand country list
d2e18b6 is described below

commit d2e18b64366ebf12886c9ba7c9926588e4404c26
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Sat Jul 3 23:01:55 2021 +0200

    expand country list
---
 contrib/Makefile.am               |  4 +++
 contrib/redux.al.json             | 56 +++++++++++++++++++++++++++++++++++
 contrib/redux.be.json             | 55 +++++++++++++++++++++++++++++++++++
 contrib/redux.countries.json      | 61 +++++++++++++++++++++++++++++++++++----
 contrib/redux.cz.json             | 56 +++++++++++++++++++++++++++++++++++
 contrib/redux.sk.json             | 56 +++++++++++++++++++++++++++++++++++
 src/reducer/Makefile.am           |  1 +
 src/reducer/anastasis_api_redux.c |  4 +--
 src/reducer/validation_CZ_BN.c    | 59 +++++++++++++++++++++++++++++++++++++
 9 files changed, 344 insertions(+), 8 deletions(-)

diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index b69a624..80ccc0f 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -14,10 +14,14 @@ EXTRA_DIST = \
   microhttpd.tag
 
 pkgdata_DATA = \
+  redux.al.json \
+  redux.be.json \
   redux.ch.json \
+  redux.cz.json \
   redux.de.json \
   redux.in.json \
   redux.jp.json \
+  redux.sk.json \
   redux.us.json \
   redux.xx.json \
   redux.xy.json \
diff --git a/contrib/redux.al.json b/contrib/redux.al.json
new file mode 100644
index 0000000..c275f2c
--- /dev/null
+++ b/contrib/redux.al.json
@@ -0,0 +1,56 @@
+{
+    "required_attributes": [
+       {
+           "type": "string",
+           "name": "full_name",
+           "label": "Full name",
+           "label_i18n":{
+               "de_DE": "Vollständiger Name",
+               "de_CH": "Vollständiger Name",
+               "fr": "Nom complet",
+               "en": "Full name"
+           },
+           "widget": "anastasis_gtk_ia_full_name",
+            "uuid" : "9e8f463f-575f-42cb-85f3-759559997331"
+       },
+       {
+           "type": "date",
+           "name": "birthdate",
+           "label": "Birthdate",
+           "label_i18n":{
+               "de_DE":"Geburtsdatum",
+               "de_CH":"Geburtsdatum",
+               "fr":"Date de naissance",
+               "en":"Birthdate"
+           },
+           "widget": "anastasis_gtk_ia_birthdate",
+            "uuid" : "83d655c7-bdb6-484d-904e-80c1058c8854"
+       },
+       {
+           "type": "string",
+           "name": "birthplace",
+           "label": "Birthplace",
+           "label_i18n":{
+                "de_CH":"Geburtsort",
+               "de_CH":"Geburtsort",
+               "fr":"Place de naissance",
+               "en":"Birthplace"
+            },
+           "widget": "anastasis_gtk_ia_birthplace",
+            "uuid" : "4c822e8e-89c6-11eb-95c4-8b077ad8489f"
+       },
+       {
+           "type": "string",
+           "name": "nid_number",
+           "label": "Numri i Identitetit",
+           "label_i18n":{
+               "en": "Identity Number",
+               "al": "Numri i Identitetit"
+           },
+           "widget": "anastasis_gtk_ia_nid_al",
+            "uuid": "256e5d30-d65e-481b-9ac4-55f5ac03b24a",
+           "validation-regex": 
"^[0-9A-T][0-9](((0|5)[0-9])|10|11|51|52)[0-9]{3}[A-W]$",
+           "validation-logic": "AL_NID_check"
+       }
+    ]
+}
diff --git a/contrib/redux.be.json b/contrib/redux.be.json
new file mode 100644
index 0000000..5c733c9
--- /dev/null
+++ b/contrib/redux.be.json
@@ -0,0 +1,55 @@
+{
+    "required_attributes": [
+       {
+           "type": "string",
+           "name": "full_name",
+           "label": "Full name",
+           "label_i18n":{
+               "de_DE": "Vollständiger Name",
+               "de_CH": "Vollständiger Name",
+               "fr": "Nom complet",
+               "en": "Full name"
+           },
+           "widget": "anastasis_gtk_ia_full_name",
+            "uuid" : "9e8f463f-575f-42cb-85f3-759559997331"
+       },
+       {
+           "type": "date",
+           "name": "birthdate",
+           "label": "Birthdate",
+           "label_i18n":{
+               "de_DE":"Geburtsdatum",
+               "de_CH":"Geburtsdatum",
+               "fr":"Date de naissance",
+               "en":"Birthdate"
+           },
+           "widget": "anastasis_gtk_ia_birthdate",
+            "uuid" : "83d655c7-bdb6-484d-904e-80c1058c8854"
+       },
+       {
+           "type": "string",
+           "name": "birthplace",
+           "label": "Birthplace",
+           "label_i18n":{
+                "de_CH":"Geburtsort",
+               "de_CH":"Geburtsort",
+               "fr":"Place de naissance",
+               "en":"Birthplace"
+            },
+           "widget": "anastasis_gtk_ia_birthplace",
+            "uuid" : "4c822e8e-89c6-11eb-95c4-8b077ad8489f"
+       },
+       {
+           "type": "string",
+           "name": "nrn_number",
+           "label": "National Register Number",
+           "label_i18n":{
+               "en": "National Register Number"
+           },
+           "widget": "anastasis_gtk_ia_nid_be",
+            "uuid": "0452f99a-06f7-48bd-8ac0-2e4ed9a24560",
+           "validation-regex": "^[0-9]{11}$",
+           "validation-logic": "BE_NRN_check"
+       }
+    ]
+}
diff --git a/contrib/redux.countries.json b/contrib/redux.countries.json
index 3342290..064a36b 100644
--- a/contrib/redux.countries.json
+++ b/contrib/redux.countries.json
@@ -1,5 +1,27 @@
 {
     "countries": [
+       {
+               "code" : "al",
+               "name" : "Albania",
+               "continent" : "Europe",
+               "name_i18n" : {
+                       "de_DE": "Albanien",
+                       "en_UK": "Albania"
+               },
+               "currency": "ALL",
+               "call_code" : "+355"
+       },
+       {
+               "code" : "be",
+               "name" : "Belgium",
+               "continent" : "Europe",
+               "name_i18n" : {
+                       "de_DE": "Belgien",
+                       "en_UK": "Belgium"
+               },
+               "currency": "EUR",
+               "call_code" : "+32"
+       },
        {
                "code" : "ch",
                "name" : "Switzerland",
@@ -10,7 +32,18 @@
                        "fr_FR": "Suisse",
                        "en_UK": "Swiss"
                },
-               "currency": "CHF"
+               "currency": "CHF",
+               "call_code" : "+41"
+       },
+       {
+               "code" : "cz",
+               "name" : "Czech Republic",
+               "continent" : "Europe",
+               "name_i18n" : {
+                       "en_UK": "Czech Republic"
+               },
+               "currency": "CZK",
+               "call_code" : "+420"
        },
        {
                "code" : "de",
@@ -23,7 +56,8 @@
                        "fr_FR": "Allemagne",
                        "en_UK": "Germany"
                 },
-               "currency": "EUR"
+               "currency": "EUR",
+               "call_code" : "+49"
        },
        {
                "code" : "in",
@@ -36,7 +70,8 @@
                        "fr_FR": "l'Inde",
                        "en_UK": "India"
                 },
-               "currency": "INR"
+               "currency": "INR",
+               "call_code" : "+91"
        },
        {
                "code" : "jp",
@@ -48,7 +83,18 @@
                        "de_CH": "Japan",
                        "en_UK": "Japan"
                 },
-               "currency": "JPY"
+               "currency": "JPY",
+               "call_code" : "+81"
+       },
+       {
+               "code" : "sl",
+               "name" : "Slovakia",
+               "continent" : "Europe",
+               "name_i18n" : {
+                       "en_UK": "Slovakia"
+               },
+               "currency": "EUR",
+               "call_code" : "+421"
        },
        {
                "code" : "us",
@@ -62,6 +108,7 @@
                        "en_UK": "United States of America (USA)"
                 },
                "currency": "USD"
+               "call_code" : "+1"
        },
        {
                "code" : "xx",
@@ -74,7 +121,8 @@
                        "fr_FR": "Testpais",
                        "en_UK": "Testland"
                 },
-               "currency": "TESTKUDOS"
+               "currency": "TESTKUDOS",
+               "call_code" : "+00"
        },
        {
                "code" : "xy",
@@ -87,7 +135,8 @@
                        "fr_FR": "Demopais",
                        "en_UK": "Demoland"
                 },
-               "currency": "KUDOS"
+               "currency": "KUDOS",
+               "call_code" : "+01"
        }
     ]
 }
diff --git a/contrib/redux.cz.json b/contrib/redux.cz.json
new file mode 100644
index 0000000..3cbd823
--- /dev/null
+++ b/contrib/redux.cz.json
@@ -0,0 +1,56 @@
+{
+    "required_attributes": [
+       {
+           "type": "string",
+           "name": "full_name",
+           "label": "Full name",
+           "label_i18n":{
+               "de_DE": "Vollständiger Name",
+               "de_CH": "Vollständiger Name",
+               "fr": "Nom complet",
+               "en": "Full name"
+           },
+           "widget": "anastasis_gtk_ia_full_name",
+            "uuid" : "9e8f463f-575f-42cb-85f3-759559997331"
+       },
+       {
+           "type": "date",
+           "name": "birthdate",
+           "label": "Birthdate",
+           "label_i18n":{
+               "de_DE":"Geburtsdatum",
+               "de_CH":"Geburtsdatum",
+               "fr":"Date de naissance",
+               "en":"Birthdate"
+           },
+           "widget": "anastasis_gtk_ia_birthdate",
+            "uuid" : "83d655c7-bdb6-484d-904e-80c1058c8854"
+       },
+       {
+           "type": "string",
+           "name": "birthplace",
+           "label": "Birthplace",
+           "label_i18n":{
+                "de_CH":"Geburtsort",
+               "de_CH":"Geburtsort",
+               "fr":"Place de naissance",
+               "en":"Birthplace"
+            },
+           "widget": "anastasis_gtk_ia_birthplace",
+            "uuid" : "4c822e8e-89c6-11eb-95c4-8b077ad8489f"
+       },
+       {
+           "type": "string",
+           "name": "birth_number",
+           "label": "Birth Number",
+           "label_i18n":{
+               "en": "Birth Number",
+               "cz": "rodné číslo"
+           },
+           "widget": "anastasis_gtk_ia_birthnumber_cz",
+            "uuid": "03e3a05b-1192-44f1-ac36-7425512eee1a",
+           "validation-regex": 
"^[0-9]{2}(((0|2|5|7)[0-9])|10|11|31|32|51|52|81|82)/[0-9]{3}[0-9]?$",
+           "validation-logic": "CZ_BN_check"
+       }
+    ]
+}
diff --git a/contrib/redux.sk.json b/contrib/redux.sk.json
new file mode 100644
index 0000000..9d6a2a6
--- /dev/null
+++ b/contrib/redux.sk.json
@@ -0,0 +1,56 @@
+{
+    "required_attributes": [
+       {
+           "type": "string",
+           "name": "full_name",
+           "label": "Full name",
+           "label_i18n":{
+               "de_DE": "Vollständiger Name",
+               "de_CH": "Vollständiger Name",
+               "fr": "Nom complet",
+               "en": "Full name"
+           },
+           "widget": "anastasis_gtk_ia_full_name",
+            "uuid" : "9e8f463f-575f-42cb-85f3-759559997331"
+       },
+       {
+           "type": "date",
+           "name": "birthdate",
+           "label": "Birthdate",
+           "label_i18n":{
+               "de_DE":"Geburtsdatum",
+               "de_CH":"Geburtsdatum",
+               "fr":"Date de naissance",
+               "en":"Birthdate"
+           },
+           "widget": "anastasis_gtk_ia_birthdate",
+            "uuid" : "83d655c7-bdb6-484d-904e-80c1058c8854"
+       },
+       {
+           "type": "string",
+           "name": "birthplace",
+           "label": "Birthplace",
+           "label_i18n":{
+                "de_CH":"Geburtsort",
+               "de_CH":"Geburtsort",
+               "fr":"Place de naissance",
+               "en":"Birthplace"
+            },
+           "widget": "anastasis_gtk_ia_birthplace",
+            "uuid" : "4c822e8e-89c6-11eb-95c4-8b077ad8489f"
+       },
+       {
+           "type": "string",
+           "name": "birth_number",
+           "label": "Birth Number",
+           "label_i18n":{
+               "en": "Birth Number",
+               "sk": "rodné číslo"
+           },
+           "widget": "anastasis_gtk_ia_birthnumber_sk",
+            "uuid": "1cd372fe-2cea-4928-9f29-66f2bdd8555c",
+           "validation-regex": 
"^[0-9]{2}(((0|2|5|7)[0-9])|10|11|31|32|51|52|81|82)/[0-9]{3}[0-9]?$",
+           "validation-logic": "CZ_BN_check"
+       }
+    ]
+}
diff --git a/src/reducer/Makefile.am b/src/reducer/Makefile.am
index faa9d7d..d9d058f 100644
--- a/src/reducer/Makefile.am
+++ b/src/reducer/Makefile.am
@@ -19,6 +19,7 @@ libanastasisredux_la_SOURCES = \
   anastasis_api_recovery_redux.c \
   anastasis_api_backup_redux.c \
   validation_CH_AHV.c \
+  validation_CZ_BN.c \
   validation_DE_SVN.c \
   validation_DE_TIN.c \
   validation_IN_AADHAR.c \
diff --git a/src/reducer/anastasis_api_redux.c 
b/src/reducer/anastasis_api_redux.c
index 01c9a79..32e124f 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -779,8 +779,8 @@ begin_provider_config_check (const json_t *currencies,
 /**
  * Function to validate an input by regular expression ("validation-regex").
  *
- * @param input ahv number to validate
- * @param regexp regular expression to validate form of ahv number
+ * @param input text to validate
+ * @param regexp regular expression to validate
  * @return true if validation passed, else false
  */
 static bool
diff --git a/src/reducer/validation_CZ_BN.c b/src/reducer/validation_CZ_BN.c
new file mode 100644
index 0000000..4598c42
--- /dev/null
+++ b/src/reducer/validation_CZ_BN.c
@@ -0,0 +1,59 @@
+/*
+  This file is part of Anastasis
+  Copyright (C) 2020, 2021 Taler Systems SA
+
+  Anastasis is free software; you can redistribute it and/or modify it under 
the
+  terms of the GNU Lesser General Public License as published by the Free 
Software
+  Foundation; either version 3, or (at your option) any later version.
+
+  Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License along with
+  Anastasis; see the file COPYING.GPL.  If not, see 
<http://www.gnu.org/licenses/>
+*/
+/**
+ * @file redux/validation_CZ_BN.c
+ * @brief validation of Czeck Birth Numbers
+ * @author Christian Grothoff
+ */
+#include <string.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <gcrypt.h>
+
+/**
+ * Function to validate a Check birth number. Basically,
+ * if it has 10 digits, it must be divisible by 11.
+ *
+ * @param b_number birth number to validate (input)
+ * @return true if b_number is valid
+ */
+bool
+CZ_BN_check (const char *b_number)
+{
+  unsigned long long n;
+  char dummy;
+  char in[11];
+
+  if (10 == strlen (b_number))
+    return true;
+  if (11 != strlen (b_number))
+    return false;
+  if (b_number[6] != '/')
+    return false;
+  memcpy (in,
+          b_number,
+          6);
+  memcpy (&in[6],
+          &b_number[7],
+          4);
+  in[10] = '\0';
+  if (1 != sscanf (in,
+                   "%llu%c",
+                   &n,
+                   &dummy))
+    return false;
+  return 0 == (n % 11);
+}

-- 
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]