[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: Beamte do not have Rentenversic
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: Beamte do not have Rentenversicherungsnummern, introduce TIN, and support optional fields |
Date: |
Tue, 30 Mar 2021 12:59:56 +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 699ec9a Beamte do not have Rentenversicherungsnummern, introduce TIN,
and support optional fields
699ec9a is described below
commit 699ec9a57ce20454263a836c649095ff4b7cc6db
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Mar 30 12:59:53 2021 +0200
Beamte do not have Rentenversicherungsnummern, introduce TIN, and support
optional fields
---
contrib/redux.de.json | 17 +++++++++++-
src/reducer/Makefile.am | 1 +
src/reducer/anastasis_api_redux.c | 6 +++++
src/reducer/validation_DE_TIN.c | 57 +++++++++++++++++++++++++++++++++++++++
4 files changed, 80 insertions(+), 1 deletion(-)
diff --git a/contrib/redux.de.json b/contrib/redux.de.json
index 11e882f..063116f 100644
--- a/contrib/redux.de.json
+++ b/contrib/redux.de.json
@@ -39,6 +39,20 @@
"widget": "anastasis_gtk_ia_birthplace",
"uuid" : "4c822e8e-89c6-11eb-95c4-8b077ad8489f"
},
+ {
+ "type": "string",
+ "name": "tax_number",
+ "label": "Taxpayer identification number",
+ "label_i18n":{
+ "de_DE": "Steuerliche Identifikationsnummer",
+ "de_CH": "Steuerliche Identifikationsnummer",
+ "en": "German taxpayer identification number"
+ },
+ "widget": "anastasis_gtk_ia_tax_de",
+ "uuid": "dae48f85-e3ff-47a4-a4a3-ed981ed8c3c6",
+ "validation-regex": "^[0-9]{11}$",
+ "validation-logic": "DE_TIN_check"
+ },
{
"type": "string",
"name": "social_security_number",
@@ -52,7 +66,8 @@
"widget": "anastasis_gtk_ia_ssn_de",
"uuid": "d5e2aa79-1c88-4cf4-a4d2-252508b38e05",
"validation-regex": "^[0-9]{8}[[:upper:]][0-9]{3}$",
- "validation-logic": "DE_SVN_check"
+ "validation-logic": "DE_SVN_check",
+ "optional" : true
}
]
}
diff --git a/src/reducer/Makefile.am b/src/reducer/Makefile.am
index 9d600e3..bf11409 100644
--- a/src/reducer/Makefile.am
+++ b/src/reducer/Makefile.am
@@ -20,6 +20,7 @@ libanastasisredux_la_SOURCES = \
anastasis_api_backup_redux.c \
validation_CH_AHV.c \
validation_DE_SVN.c \
+ validation_DE_TIN.c \
validation_XX_SQUARE.c \
validation_XY_PRIME.c
libanastasisredux_la_LIBADD = \
diff --git a/src/reducer/anastasis_api_redux.c
b/src/reducer/anastasis_api_redux.c
index 05a6870..81d9435 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -1203,6 +1203,7 @@ enter_user_attributes (json_t *state,
const char *attribute_value;
const char *regexp = NULL;
const char *reglog = NULL;
+ int optional = false;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("name",
&name),
@@ -1212,6 +1213,9 @@ enter_user_attributes (json_t *state,
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("validation-logic",
®log)),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_boolean ("optional",
+ &optional)),
GNUNET_JSON_spec_end ()
};
@@ -1231,6 +1235,8 @@ enter_user_attributes (json_t *state,
name));
if (NULL == attribute_value)
{
+ if (optional)
+ continue;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Request is missing required attribute `%s'\n",
name);
diff --git a/src/reducer/validation_DE_TIN.c b/src/reducer/validation_DE_TIN.c
new file mode 100644
index 0000000..9c97365
--- /dev/null
+++ b/src/reducer/validation_DE_TIN.c
@@ -0,0 +1,57 @@
+/*
+ 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_DE_TIN.c
+ * @brief validation logic for German taxpayer identification numbers
+ * @author Christian Grothoff
+ */
+#include <string.h>
+#include <stdbool.h>
+
+
+/**
+ * Function to validate a German Taxpayer identification number.
+ *
+ * See https://de.wikipedia.org/wiki/Steuerliche_Identifikationsnummer
+ * for the structure!
+ *
+ * @param tin_number tax number to validate (input)
+ * @return true if validation passed, else false
+ */
+bool
+DE_TIN_check (const char *tin_number)
+{
+ unsigned int csum;
+ unsigned int product = 10;
+
+ if (strlen (tin_number) != 11)
+ return false;
+ for (unsigned int i = 0; i<10; i++)
+ {
+ unsigned int sum = ((tin_number[i] - '0') + product) % 10;
+ if (0 == sum)
+ sum = 10;
+ product = sum * 2 % 11;
+ }
+ csum = 11 - product;
+ if (10 == csum)
+ csum = 0;
+ if (tin_number[10] != '0' + csum)
+ return false;
+ if (tin_number[0] == '0')
+ return false;
+ return true;
+}
--
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: Beamte do not have Rentenversicherungsnummern, introduce TIN, and support optional fields,
gnunet <=