commit 658d0b985171b472a0ef16c4241dabd5b7ff3948
parent b3401596a3ef38220da7a4c94ea4bfe10aca71b0
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 22 Jun 2025 12:38:38 +0200
possible fix for #9885, untested
Diffstat:
4 files changed, 144 insertions(+), 0 deletions(-)
diff --git a/src/kyclogic/taler-exchange-helper-measure-test-form b/src/kyclogic/taler-exchange-helper-measure-test-form
@@ -85,6 +85,17 @@ fi
# First, check everything we expect is in stdin.
A=$(jq -r .attributes)
+
+# Get form ID
+FORM_ID=$(echo "$A" | jq -r '.form_id')
+
+# The 'form' here should be the 'test' form
+if [ "$FORM_ID" != "test" ]
+then
+ exit_fail "Invalid form ID"
+fi
+
+
J=$(echo "$A" | jq -r 'def get($k):
if has($k)
then .[$k]
diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-3rdparty-check b/src/kyclogic/taler-exchange-helper-measure-tops-3rdparty-check
@@ -88,6 +88,33 @@ fi
# First, extract inputs we need
INPUTS=$(jq '{"current_rules":.current_rules,"attributes":.attributes}')
+# Check form ID, must be 'vqf-902.11'
+FORM_ID=$(echo "$INPUTS" | jq -r '.attributes.form_id')
+
+# The 'form' here should be the VQF 902.11 customer form
+if [ "$FORM_ID" != "vqf_902_11_customer" ]
+then
+ echo "Unexpected form ID $FORM_ID" 1>&2
+ exec taler-exchange-helper-measure-freeze
+fi
+
+# Check all mandatory attributes are present.
+echo "$INPUTS" \
+ | jq '.attributes' \
+ | jq -r 'def get($k):
+ if has($k)
+ then .[$k]
+ else error("attribute missing")
+ end;
+ {"THIRD_PARTY_OWNERSHIP":get("THIRD_PARTY_OWNERSHIP"),
+ "CONTROL_REASON":get("CONTROL_REASON"),
+ "SUBMITTED_BY":get("SUBMITTED_BY"),
+ "SIGN_DATE":get("SIGN_DATE"),
+ "SIGNATURE":get("SIGNATURE")}' \
+ > /dev/null \
+ || exec taler-exchange-helper-measure-freeze
+
+
# Get entity type
CONTROL3P=$(echo "$INPUTS" | jq -r '.attributes.THIRD_PARTY_OWNERSHIP')
# Get current rules.
diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-kyx-check b/src/kyclogic/taler-exchange-helper-measure-tops-kyx-check
@@ -89,6 +89,18 @@ fi
# First, extract inputs we need
INPUTS=$(jq '{"current_rules":.current_rules,"attributes":.attributes}')
+
+# Check form ID, must be 'vqf-902.11'
+FORM_ID=$(echo "$INPUTS" | jq -r '.attributes.form_id')
+
+# The 'form' here should be the VQF 902.11 customer form
+if [ "$FORM_ID" != "vqf_902_1_customer" ]
+then
+ echo "Unexpected form ID $FORM_ID" 1>&2
+ echo "$INPUTS" | exec taler-exchange-helper-measure-freeze
+ exit 1
+fi
+
# Get entity type
LEGAL_ENTITY=$(echo "$INPUTS" | jq -r '.attributes.CUSTOMER_TYPE_VQF // null')
# Get current rules.
@@ -96,6 +108,7 @@ CURRENT_RULES=$(echo "$INPUTS" | jq '.current_rules // null')
# Get context values.
EXPIRATION_TIME=$(echo "$INPUTS" | jq '.context.expiration_time // .current_rules.expiration_time // null')
+# What is the next form to show?
FORM="error"
INVESTIGATE="false"
@@ -103,27 +116,97 @@ case "$LEGAL_ENTITY"
in
"NATURAL_PERSON")
FORM="none"
+ # Check all mandatory attributes are present.
+ echo "$INPUTS" \
+ | jq '.attributes' \
+ | jq -r 'def get($k):
+ if has($k)
+ then .[$k]
+ else error("attribute missing")
+ end;
+ {"DATE_OF_BIRTH":get("DATE_OF_BIRTH"),
+ "PERSONAL_IDENTIFICATION_DOCUMENT_COPY":get("PERSONAL_IDENTIFICATION_DOCUMENT_COPY"),
+ "CUSTOMER_IS_SOLE_PROPRIETOR":get("CUSTOMER_IS_SOLE_PROPRIETOR"),
+ "FULL_NAME":get("FULL_NAME")}' \
+ > /dev/null \
+ || exec taler-exchange-helper-measure-freeze
;;
"OPERATIONAL")
FORM="form-vqf-902.11"
+ # Check all mandatory attributes are present.
+ echo "$INPUTS" \
+ | jq '.attributes' \
+ | jq -r 'def get($k):
+ if has($k)
+ then .[$k]
+ else error("attribute missing")
+ end;
+ {"REGISTERED_OFFICE_ADDRESS":get("REGISTERED_OFFICE_ADDRESS"),
+ "LEGAL_ENTITY_IDENTIFICATION_DOCUMENT_COPY":get("LEGAL_ENTITY_IDENTIFICATION_DOCUMENT_COPY"),
+ "ESTABLISHER_LIST":get("ESTABLISHER_LIST"),
+ "COMPANY_NAME":get("COMPANY_NAME")}' \
+ > /dev/null \
+ || exec taler-exchange-helper-measure-freeze
;;
"FOUNDATION")
# FIXME: #9825: Not yet supported!
# FORM="vqf-902.12"
FORM=error
INVESTIGATE="true"
+ # Check all mandatory attributes are present.
+ echo "$INPUTS" \
+ | jq '.attributes' \
+ | jq -r 'def get($k):
+ if has($k)
+ then .[$k]
+ else error("attribute missing")
+ end;
+ {"REGISTERED_OFFICE_ADDRESS":get("REGISTERED_OFFICE_ADDRESS"),
+ "LEGAL_ENTITY_IDENTIFICATION_DOCUMENT_COPY":get("LEGAL_ENTITY_IDENTIFICATION_DOCUMENT_COPY"),
+ "ESTABLISHER_LIST":get("ESTABLISHER_LIST"),
+ "COMPANY_NAME":get("COMPANY_NAME")}' \
+ > /dev/null \
+ || exec taler-exchange-helper-measure-freeze
;;
"TRUST")
# FIXME: #9027: Not yet supported!
# FORM="vqf-902.13"
FORM=error
INVESTIGATE="true"
+ # Check all mandatory attributes are present.
+ echo "$INPUTS" \
+ | jq '.attributes' \
+ | jq -r 'def get($k):
+ if has($k)
+ then .[$k]
+ else error("attribute missing")
+ end;
+ {"REGISTERED_OFFICE_ADDRESS":get("REGISTERED_OFFICE_ADDRESS"),
+ "LEGAL_ENTITY_IDENTIFICATION_DOCUMENT_COPY":get("LEGAL_ENTITY_IDENTIFICATION_DOCUMENT_COPY"),
+ "ESTABLISHER_LIST":get("ESTABLISHER_LIST"),
+ "COMPANY_NAME":get("COMPANY_NAME")}' \
+ > /dev/null \
+ || exec taler-exchange-helper-measure-freeze
;;
"LIFE_INSURANCE")
# FIXME: #9826: Not yet supported!
# FORM="vqf-902.15"
FORM=error
INVESTIGATE="true"
+ # Check all mandatory attributes are present.
+ echo "$INPUTS" \
+ | jq '.attributes' \
+ | jq -r 'def get($k):
+ if has($k)
+ then .[$k]
+ else error("attribute missing")
+ end;
+ {"REGISTERED_OFFICE_ADDRESS":get("REGISTERED_OFFICE_ADDRESS"),
+ "LEGAL_ENTITY_IDENTIFICATION_DOCUMENT_COPY":get("LEGAL_ENTITY_IDENTIFICATION_DOCUMENT_COPY"),
+ "ESTABLISHER_LIST":get("ESTABLISHER_LIST"),
+ "COMPANY_NAME":get("COMPANY_NAME")}' \
+ > /dev/null \
+ || exec taler-exchange-helper-measure-freeze
;;
"OTHER")
FORM="form-vqf-902.9"
diff --git a/src/kyclogic/taler-exchange-helper-measure-validate-accepted-tos b/src/kyclogic/taler-exchange-helper-measure-validate-accepted-tos
@@ -92,6 +92,29 @@ fi
# First, extract inputs we need
INPUTS=$(jq '{"current_rules":.current_rules,"attributes":.attributes,"context":.context}')
+# Check form ID, must be 'accept-tos'
+FORM_ID=$(echo "$INPUTS" | jq -r '.attributes.form_id')
+
+# The 'form' here should be the accept TOS form
+if [ "$FORM_ID" != "accept_tos" ]
+then
+ echo "Unexpected form ID $FORM_ID" 1>&2
+ echo "$INPUTS" | exec taler-exchange-helper-measure-freeze
+ exit 1
+fi
+
+echo "$INPUTS" \
+ | jq '.attributes' \
+ | jq -r 'def get($k):
+ if has($k)
+ then .[$k]
+ else error("attribute missing")
+ end;
+ {"DOWNLOADED_TERMS_OF_SERVICE":get("DOWNLOADED_TERMS_OF_SERVICE"),
+ "ACCEPTED_TERMS_OF_SERVICE":get("ACCEPTED_TERMS_OF_SERVICE")}' \
+ > /dev/null \
+ || exec taler-exchange-helper-measure-freeze
+
# Get ToS acceptance confirmation.
TOS_ACCEPTED=$(echo "$INPUTS" | jq '.attributes.ACCEPTED_TERMS_OF_SERVICE // null')
# Get current rules.