gnunet-svn
[Top][All Lists]
Advanced

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

[exchange] branch master updated: add missing file


From: Admin
Subject: [exchange] branch master updated: add missing file
Date: Tue, 25 Feb 2025 21:33:56 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new e4e213d26 add missing file
e4e213d26 is described below

commit e4e213d260733a1e557aa1a0f32880d63cef29af
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Feb 25 21:33:46 2025 +0100

    add missing file
---
 ...ler-exchange-helper-measure-tops-3rdparty-check | 145 +++++++++++++++++++++
 1 file changed, 145 insertions(+)

diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-3rdparty-check 
b/src/kyclogic/taler-exchange-helper-measure-tops-3rdparty-check
new file mode 100755
index 000000000..c08eeae9a
--- /dev/null
+++ b/src/kyclogic/taler-exchange-helper-measure-tops-3rdparty-check
@@ -0,0 +1,145 @@
+#!/bin/bash
+#
+#  This file is part of TALER
+#  Copyright (C) 2025 Taler Systems SA
+#
+#  TALER 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.
+#
+#  TALER 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
+#  TALER; see the file COPYING.  If not, If not, see 
<http://www.gnu.org/license>
+#
+
+# Hard error reporting on.
+set -eu
+
+
+# Exit, with error message (hard failure)
+function exit_fail() {
+    echo " FAIL: " "$@" >&2
+    EXIT_STATUS=1
+    exit "$EXIT_STATUS"
+}
+
+CONF="$HOME/.config/taler-exchange.conf"
+VERBOSE=0
+
+while getopts 'ac:hirvV' OPTION;
+do
+    case "$OPTION" in
+        a)
+            # Controlling entity 3rd person field is required.
+            echo "CONTROLLING_ENTITY_THIRD_PERSON"
+            exit 0
+            ;;
+        c)
+            # shellcheck disable=SC2034
+            CONF="$OPTARG"
+            ;;
+        h)
+            echo "This is a KYC measure program that determines the next VQF 
form to ask for (if any) based on the type of legal entity the customer claimed 
to be on the primary form."
+            echo 'Supported options:'
+            echo '  -a           -- show required attributes'
+            # shellcheck disable=SC2016
+            echo '  -c $CONF     -- set configuration'
+            echo '  -h           -- print this help'
+            echo '  -i           -- show required inputs'
+            echo '  -r           -- show required context'
+            echo '  -v           -- show version'
+            echo '  -V           -- be verbose'
+            exit 0
+            ;;
+        i)
+            # Need context and current_rules.
+            echo "attributes"
+            echo "current_rules"
+            exit 0
+            ;;
+        r)
+            # Nothing needed from context
+            exit 0
+            ;;
+        v)
+            echo "$0 v0.0.1"
+            exit 0
+            ;;
+        V)
+            VERBOSE=1
+            ;;
+        ?)
+        exit_fail "Unrecognized command line option"
+        ;;
+    esac
+done
+
+if [ 1 = "$VERBOSE" ]
+then
+    echo "Running $0" 1>&2
+fi
+
+# See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlProgramInput
+# for the full JSON with possible inputs.
+
+# First, extract inputs we need
+INPUTS=$(jq '{"current_rules":.current_rules,"attributes":.attributes}')
+
+# Get entity type
+CONTROL3P=$(echo "$INPUTS" | jq '.attributes.CONTROLLING_ENTITY_THIRD_PERSON 
// null')
+# Get current rules.
+CURRENT_RULES=$(echo "$INPUTS" | jq '.current_rules // null')
+# Get context values.
+EXPIRATION_TIME=$(echo "$INPUTS" | jq '.context.expiration_time // 
.current_rules.expiration_time // null')
+
+FORM="error"
+
+case "$CONTROL3P"
+in
+    "false")
+        FORM="none"
+    ;;
+    "true")
+        FORM="902.9"
+    ;;
+esac
+
+# Check high-level case
+case "$FORM"
+in
+    "error")
+        # This should not happen, immediately trigger investigation and show 
error to the user.
+        echo "ERROR: Unexpected value for controlling entity is 3rd person 
'${CONTROL3P}'" 1>&2
+        NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] | select 
(.rule_name==\"kyc-rule-deposit-limit-zero\").measures=["form-info-internal-error"])')
+        INVESTIGATE="true"
+        ;;
+    "none")
+        # Immediately trigger address validation.
+        echo "$INPUTS" | taler-exchange-helper-measure-tops-address-check
+        exit $?
+        ;;
+    *)
+        # Proceed to FORM.
+        echo "Selected VQF form ${FORM}." 1&>2
+
+        # Force user to fill in $FORM
+        NEW_RULES=$(echo "$CURRENT_RULES" | jq "(.rules[] | select 
(.rule_name==\"kyc-rule-deposit-limit-zero\").measures=[\"form-${FORM}\"])")
+        INVESTIGATE="false"
+        ;;
+esac
+
+# Finally, output the new rules.
+# See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlOutcome
+# for the required output format.
+jq \
+    --argjson inv "$INVESTIGATE" \
+    --argjson et "$EXPIRATION_TIME" \
+    --argjson sm "$SUCCESSOR_MEASURE" \
+    --argjson cm "$CUSTOM_MEASURES" \
+    --argjson nr "$NEW_RULES" \
+    
'{"to_investigate":$inv,"new_rules":$nr+{"expiration_time":$et,"successor_measure":$sm,"custom_measures":($nr.custom_measures+$cm)}}|del(..|nulls)'
+
+exit 0

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