gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: add support for NL


From: gnunet
Subject: [taler-anastasis] branch master updated: add support for NL
Date: Sun, 27 Feb 2022 15:57:10 +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 18d7ebb  add support for NL
18d7ebb is described below

commit 18d7ebb1b74e81c5ccf750dda4cfe5c0c268f88d
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Feb 27 15:57:07 2022 +0100

    add support for NL
---
 contrib/Makefile.am                      |  1 +
 contrib/redux.countries.json             | 14 +++++++-
 contrib/redux.es.json                    |  4 +--
 contrib/{redux.es.json => redux.nl.json} | 26 +++++----------
 src/reducer/Makefile.am                  |  1 +
 src/reducer/validation_NL_BSN.c          | 57 ++++++++++++++++++++++++++++++++
 6 files changed, 82 insertions(+), 21 deletions(-)

diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index a2bdf27..03bcab7 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -59,6 +59,7 @@ pkgdata_DATA = \
   redux.in.json \
   redux.it.json \
   redux.jp.json \
+  redux.nl.json \
   redux.sk.json \
   redux.us.json \
   redux.xx.json \
diff --git a/contrib/redux.countries.json b/contrib/redux.countries.json
index 8fb2e99..44416e1 100644
--- a/contrib/redux.countries.json
+++ b/contrib/redux.countries.json
@@ -122,7 +122,19 @@
                "call_code" : "+81"
        },
        {
-               "code" : "sl",
+               "code" : "nl",
+               "name" : "Netherlands",
+               "continent" : "Europe",
+               "name_i18n" : {
+                       "de_DE": "Niederlande",
+                        "nl_NL": "Nederland",
+                       "en_UK": "Netherlands"
+               },
+               "currency": "EUR",
+               "call_code" : "+31"
+       },
+       {
+               "code" : "sk",
                "name" : "Slovakia",
                "continent" : "Europe",
                "name_i18n" : {
diff --git a/contrib/redux.es.json b/contrib/redux.es.json
index 5926b6d..d4a6b2a 100644
--- a/contrib/redux.es.json
+++ b/contrib/redux.es.json
@@ -28,7 +28,7 @@
            "name": "tax_number",
            "label": "Tax number",
            "label_i18n":{
-               "es_ES":"Número de Identificación Fiscal (DNI, NIE)",
+               "es_ES":"Número de Identificación Fiscal (DNI, NIE)"
            },
            "widget": "anastasis_gtk_ia_es_dni",
             "uuid" : "ac8bd865-6be8-445c-b650-6a18eef16a49",
@@ -40,7 +40,7 @@
            "name": "ssn_number",
            "label": "Social security number",
            "label_i18n":{
-               "es_ES":"Número de Seguridad Social",
+               "es_ES":"Número de Seguridad Social"
            },
            "widget": "anastasis_gtk_ia_es_ssn",
             "uuid" : "22396a19-f3bb-497e-b63a-961fd639140e",
diff --git a/contrib/redux.es.json b/contrib/redux.nl.json
similarity index 53%
copy from contrib/redux.es.json
copy to contrib/redux.nl.json
index 5926b6d..506c2d0 100644
--- a/contrib/redux.es.json
+++ b/contrib/redux.nl.json
@@ -25,26 +25,16 @@
        },
        {
            "type": "string",
-           "name": "tax_number",
-           "label": "Tax number",
+           "name": "social_security_number",
+           "label": "Citizen Service Number",
            "label_i18n":{
-               "es_ES":"Número de Identificación Fiscal (DNI, NIE)",
+               "nl_NL": "Burgerservicenummer (BSN)",
+               "en": "Citizen Service Number"
            },
-           "widget": "anastasis_gtk_ia_es_dni",
-            "uuid" : "ac8bd865-6be8-445c-b650-6a18eef16a49",
-           "validation-regex": "^[0-9MXYZ][0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKE]$",
-           "validation-logic": "ES_DNI_check"
-       },
-       {
-           "type": "string",
-           "name": "ssn_number",
-           "label": "Social security number",
-           "label_i18n":{
-               "es_ES":"Número de Seguridad Social",
-           },
-           "widget": "anastasis_gtk_ia_es_ssn",
-            "uuid" : "22396a19-f3bb-497e-b63a-961fd639140e",
-           "validation-regex": "^[0-9]{11}$"
+           "widget": "anastasis_gtk_ia_ssn_nl",
+            "uuid": "b6bf1f14-1f85-4afb-af21-f54b88490bdc",
+           "validation-regex": "^[1-9][0-9]{8}$",
+           "validation-logic": "NL_BSN_check"
        }
     ]
 }
diff --git a/src/reducer/Makefile.am b/src/reducer/Makefile.am
index 7aa389e..bfdb521 100644
--- a/src/reducer/Makefile.am
+++ b/src/reducer/Makefile.am
@@ -26,6 +26,7 @@ libanastasisredux_la_SOURCES = \
   validation_ES_DNI.c \
   validation_IN_AADHAR.c \
   validation_IT_CF.c \
+  validation_NL_BSN.c \
   validation_XX_SQUARE.c \
   validation_XY_PRIME.c
 libanastasisredux_la_LIBADD = \
diff --git a/src/reducer/validation_NL_BSN.c b/src/reducer/validation_NL_BSN.c
new file mode 100644
index 0000000..f92bb38
--- /dev/null
+++ b/src/reducer/validation_NL_BSN.c
@@ -0,0 +1,57 @@
+/*
+  This file is part of Anastasis
+  Copyright (C) 2020, 2021 Anastasis SARL
+
+  Anastasis is free software; you can redistribute it and/or modify it under 
the
+  terms of the GNU 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 reducer/validation_NL_BSN.c
+ * @brief Validation for Dutch Buergerservicenummern
+ * @author Christian Grothoff
+ */
+#include <string.h>
+#include <stdbool.h>
+
+
+/**
+ * Function to validate a Dutch Social Security number.
+ *
+ * See https://nl.wikipedia.org/wiki/Burgerservicenummer
+ *
+ * @param bsn_number social security number to validate (input)
+ * @return true if validation passed, else false
+ */
+bool
+NL_BSN_check (const char *bsn_number)
+{
+  static const int factors[] = {
+    9, 8, 7, 6, 5, 4, 3, 2, -1
+  };
+  unsigned int sum = 0;
+
+  if (strlen (bsn_number) != 9)
+    return false;
+  for (unsigned int i = 0; i<8; i++)
+  {
+    unsigned char c = (unsigned char) bsn_number[i];
+
+    if ( ('0' > c) || ('9' < c) )
+      return false;
+    sum += (c - '0') * factors[i];
+  }
+  {
+    unsigned char c = (unsigned char) bsn_number[8];
+    unsigned int v = (c - '0');
+
+    return (sum % 11 == v);
+  }
+}

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