aboutsummaryrefslogtreecommitdiff
path: root/src/kyclogic/taler-exchange-helper-measure-defaults-but-investigate
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-11-19 21:57:04 +0100
committerChristian Grothoff <christian@grothoff.org>2024-11-19 21:57:04 +0100
commitdb476a2a7c5ebe2df2ae21960595684e2e9046bf (patch)
tree848bce204b208d2ff0be9c9ed659851ecc3d4193 /src/kyclogic/taler-exchange-helper-measure-defaults-but-investigate
parent2f57aa7932358534f34414d3c1b6f00a50b1b4a4 (diff)
add new taler-exchange-helper-measure programs
Diffstat (limited to 'src/kyclogic/taler-exchange-helper-measure-defaults-but-investigate')
-rw-r--r--src/kyclogic/taler-exchange-helper-measure-defaults-but-investigate94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/kyclogic/taler-exchange-helper-measure-defaults-but-investigate b/src/kyclogic/taler-exchange-helper-measure-defaults-but-investigate
new file mode 100644
index 000000000..5f9138795
--- /dev/null
+++ b/src/kyclogic/taler-exchange-helper-measure-defaults-but-investigate
@@ -0,0 +1,94 @@
+#!/bin/bash
+#
+# This file is part of TALER
+# Copyright (C) 2024 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)
+ # No attributes are required.
+ exit 0
+ ;;
+ c)
+ # shellcheck disable=SC2034
+ CONF="$OPTARG"
+ ;;
+ h)
+ echo "This is a KYC measure program that applies default rules to an account, but flags it for manual investigation."
+ 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'
+ ;;
+ i)
+ # Need default rules.
+ echo "default_rules"
+ exit 0
+ ;;
+ r)
+ # No context is required.
+ exit 0
+ ;;
+ v)
+ echo "$0 v0.0.0"
+ 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
+DEFAULT_RULES=$(jq '.default_rules')
+
+# Finally, output the new rules.
+# See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlOutcome
+# for the required output format.
+
+echo "$DEFAULT_RULES" \
+ | jq '.+{"to_investigate": true}'