[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: work on tops AML helpers
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: work on tops AML helpers |
Date: |
Sun, 22 Dec 2024 15:03:29 +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 53d3b742e work on tops AML helpers
53d3b742e is described below
commit 53d3b742e90dbd275b2d08e96613d12ac4280b77
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Dec 22 15:03:21 2024 +0100
work on tops AML helpers
---
src/kyclogic/kyclogic_api.c | 7 ++++
.../taler-exchange-helper-measure-tops-kyx-check | 44 +++++++++++++---------
...taler-exchange-helper-measure-tops-postal-check | 5 ++-
.../taler-exchange-helper-measure-tops-sms-check | 6 ++-
4 files changed, 41 insertions(+), 21 deletions(-)
diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c
index ac95eec06..725c3878b 100644
--- a/src/kyclogic/kyclogic_api.c
+++ b/src/kyclogic/kyclogic_api.c
@@ -632,6 +632,7 @@ TALER_KYCLOGIC_rules_parse (const json_t *jlrs)
struct TALER_KYCLOGIC_KycRule *rule
= &lrs->kyc_rules[off];
const json_t *jmeasures;
+ const char *rn = NULL;
struct GNUNET_JSON_Specification ispec[] = {
TALER_JSON_spec_kycte ("operation_type",
&rule->trigger),
@@ -648,6 +649,10 @@ TALER_KYCLOGIC_rules_parse (const json_t *jlrs)
GNUNET_JSON_spec_bool ("exposed",
&rule->exposed),
NULL),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_string ("rule_name",
+ &rn),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("is_and_combinator",
&rule->is_and_combinator),
@@ -669,6 +674,8 @@ TALER_KYCLOGIC_rules_parse (const json_t *jlrs)
(int) rule->trigger,
TALER_amount2s (&rule->threshold));
rule->lrs = lrs;
+ if (NULL != rn)
+ rule->rule_name = GNUNET_strdup (rn);
rule->num_measures = json_array_size (jmeasures);
rule->next_measures
= GNUNET_new_array (rule->num_measures,
diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-kyx-check
b/src/kyclogic/taler-exchange-helper-measure-tops-kyx-check
index 868678962..28bbd117b 100755
--- a/src/kyclogic/taler-exchange-helper-measure-tops-kyx-check
+++ b/src/kyclogic/taler-exchange-helper-measure-tops-kyx-check
@@ -65,7 +65,7 @@ do
exit 0
;;
v)
- echo "$0 v0.0.0"
+ echo "$0 v0.0.1"
exit 0
;;
V)
@@ -95,6 +95,8 @@ 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 "$LEGAL_ENTITY"
in
"NATURAL")
@@ -118,31 +120,39 @@ in
esac
# Check high-level case
-if [ "$FORM" == "none" ]
-then
- # Proceed to AML stage, preserve rules
- # FIXME: check if we have to change anything in the rules to prevent
- # the user from getting the basic KYC form *again*!
- echo "$INPUTS" | taler-exchange-helper-measure-preserve-but-investigate
- exit $?
-fi
+case "$FORM"
+in
+ "error")
+ # This should not happen, immediately trigger investigation and show
error to the user.
+ echo "ERROR: Unexpected legal entity '${LEGAL_ENTITY}'" 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 investigation.
+ # FIXME: or rather: address validation!
+ NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] | select
(.rule_name==\"kyc-rule-deposit-limit-zero\").measures=["form-info-investigation"])')
+ INVESTIGATE="true"
+ ;;
+ *)
+ # Proceed to FORM.
+ echo "Selected VQF form ${FORM}." 1&>2
-# Proceed to FORM.
-echo "Selected VQF form ${FORM}." 1&>2
-# FIXME: force user to fill in $FORM
-# FIXME: instead of this insanity, match against rule_name!
-# NEW_RULES=$(echo "$CURRENT_RULES" | jq 'walk(if (type == "object" and ( (
(.operation_type == "withdraw") and (.threshold ==
"${EXCHANGE_AML_PROGRAM_TOPS_SMS_WITHDRAW_THRESHOLD") ) or ( (.operation_type
== "merge") and (.threshold ==
"${EXCHANGE_AML_PROGRAM_TOPS_SMS_MERGE_THRESHOLD" ) ) ) ) then del(.) else .
end)')
-echo "Not implemented"
-exit 1 # not implemented
+ # 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 \
+ --jsonarg inv "$INVESTIGATE" \
--jsonarg et "$EXPIRATION_TIME" \
--jsonarg sm "$SUCCESSOR_MEASURE" \
--jsonarg cm "$CUSTOM_MEASURES" \
--jsonarg nr "$NEW_RULES" \
-
'{"new_rules":$nr+{"expiration_time":$et,"successor_measure":$sm,"custom_measures":($nr.custom_measures+$cm)}}|del(..|nulls)'
+
'{"to_investigate":$inv,"new_rules":$nr+{"expiration_time":$et,"successor_measure":$sm,"custom_measures":($nr.custom_measures+$cm)}}|del(..|nulls)'
exit 0
diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-postal-check
b/src/kyclogic/taler-exchange-helper-measure-tops-postal-check
index 497a1a832..1c8914114 100755
--- a/src/kyclogic/taler-exchange-helper-measure-tops-postal-check
+++ b/src/kyclogic/taler-exchange-helper-measure-tops-postal-check
@@ -70,7 +70,7 @@ do
exit 0
;;
v)
- echo "$0 v0.0.0"
+ echo "$0 v0.0.1"
exit 0
;;
V)
@@ -112,7 +112,8 @@ if $(echo "$COUNTRY" | grep -E -e
${EXCHANGE_AML_PROGRAM_TOPS_POSTAL_CHECK_COUNT
then
# Valid country
# Remove limitation from current rules.
- NEW_RULES=$(echo "$CURRENT_RULES" | jq 'walk(if (type == "object" and ( (
(.operation_type == "withdraw") and (.threshold ==
"${EXCHANGE_AML_PROGRAM_TOPS_POSTAL_WITHDRAW_THRESHOLD") ) or (
(.operation_type == "merge") and (.threshold ==
"${EXCHANGE_AML_PROGRAM_TOPS_POSTAL_MERGE_THRESHOLD" ) ) ) ) then del(.) else .
end)')
+ NEW_RULES=$(echo "$CURRENT_RULES" | jq 'del(.rules[] | select
((.rule_name=="kyc-rule-p2p-domestic-identification-requirement") ||
(.rule_name=="kyc-rule-withdraw-limit-low") ))')
+
else
# Invalid country
echo "Country ${COUNTRY} invalid." 1&>2
diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-sms-check
b/src/kyclogic/taler-exchange-helper-measure-tops-sms-check
index 4817fcc5f..e15c34b79 100755
--- a/src/kyclogic/taler-exchange-helper-measure-tops-sms-check
+++ b/src/kyclogic/taler-exchange-helper-measure-tops-sms-check
@@ -68,7 +68,7 @@ do
exit 0
;;
v)
- echo "$0 v0.0.0"
+ echo "$0 v0.0.1"
exit 0
;;
V)
@@ -108,7 +108,9 @@ if $(echo "$PHONE_NUMBER" | grep -E -e
${EXCHANGE_AML_PROGRAM_TOPS_SMS_CHECK_REG
then
# Valid phone number
# Remove limitation from current rules.
- NEW_RULES=$(echo "$CURRENT_RULES" | jq 'walk(if (type == "object" and ( (
(.operation_type == "withdraw") and (.threshold ==
"${EXCHANGE_AML_PROGRAM_TOPS_SMS_WITHDRAW_THRESHOLD") ) or ( (.operation_type
== "merge") and (.threshold ==
"${EXCHANGE_AML_PROGRAM_TOPS_SMS_MERGE_THRESHOLD" ) ) ) ) then del(.) else .
end)')
+ # Remove limitation from current rules.
+ NEW_RULES=$(echo "$CURRENT_RULES" | jq 'del(.rules[] | select
((.rule_name=="kyc-rule-p2p-domestic-identification-requirement") ||
(.rule_name=="kyc-rule-withdraw-limit-low") ))')
+
else
# Invalid phone number
echo "Phone number ${PHONE_NUMBER} invalid." 1&>2
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: work on tops AML helpers,
gnunet <=