commit 016a2f1f9c7cb9b4ff388b5c39b8bda8f6e3ccd1 parent 16edf591fb5c6d5ab38da3f6dd51bbf63bb8b87b Author: Christian Grothoff <christian@grothoff.org> Date: Tue, 8 Apr 2025 00:13:07 +0200 fix misc. issues with AML programs Diffstat:
7 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/src/kyclogic/taler-exchange-helper-measure-enable-deposits b/src/kyclogic/taler-exchange-helper-measure-enable-deposits @@ -114,10 +114,10 @@ fi # Finally, output the new rules. # See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlOutcome # for the required output format. -jq \ +jq -n \ --argjson et "$EXPIRATION_TIME" \ --argjson sm "$SUCCESSOR_MEASURE" \ --argjson nr "$NEW_RULES" \ - '{"new_rules":$nr+{"expiration_time":$et,"successor_measure":$sm)}}|del(..|nulls)' + '{"new_rules":($nr+{"expiration_time":$et,"successor_measure":$sm})}|del(..|nulls)' exit 0 diff --git a/src/kyclogic/taler-exchange-helper-measure-inform-investigate b/src/kyclogic/taler-exchange-helper-measure-inform-investigate @@ -89,7 +89,7 @@ CURRENT_RULES=$(jq '.current_rules') # FIXME: not generic, figure out how to do this nicely regardless of # what rule we are at. -NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] | select (.rule_name==\"kyc-rule-deposit-limit-zero\").measures=["form-info-investigation"])') +NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] | select (.rule_name=="deposit-limit-zero").measures=["form-info-investigation"])') # Finally, output the new rules. diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-3rdparty-check b/src/kyclogic/taler-exchange-helper-measure-tops-3rdparty-check @@ -113,7 +113,7 @@ 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"])') + NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] | select (.rule_name=="deposit-limit-zero").measures=["form-info-internal-error"])') INVESTIGATE="true" ;; "none") @@ -126,7 +126,7 @@ in 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}\"])") + NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] | select (.rule_name=="deposit-limit-zero").measures=["form-${FORM}"])') INVESTIGATE="false" ;; esac @@ -134,12 +134,14 @@ esac # Finally, output the new rules. # See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlOutcome # for the required output format. -jq \ +jq -n \ --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)' + '{"to_investigate":$inv,"new_rules":($nr+{"expiration_time":$et,"successor_measure":$sm,"custom_measures":($nr.custom_measures+$cm)})}|del(..|nulls)' + +# FIXME: If we keep nr.custom_measures in "custom_measures", should we not ".del()" them from "new_rules"? exit 0 diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-address-check b/src/kyclogic/taler-exchange-helper-measure-tops-address-check @@ -880,7 +880,7 @@ CUSTOM_MEASURES=$(jq \ '{"custom-address-investigation":{"context":{"initial_address":$address},"check_name":"postal-registration","prog_name":"inform-investigate","operation_type":"DEPOSIT"}}') # Then trigger Challenger address check via oauth2, kyc-check-postal-registration -NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] | select (.rule_name=="kyc-rule-deposit-limit-zero").measures=["custom-address-investigation"])' | jq --argjson cm "$CUSTOM_MEASURES" '.custom_measures=$cm') +NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] | select (.rule_name=="deposit-limit-zero").measures=["custom-address-investigation"])' | jq --argjson cm "$CUSTOM_MEASURES" '.custom_measures=$cm') # Finally, output the new rules. # See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlOutcome diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-kyx-check b/src/kyclogic/taler-exchange-helper-measure-tops-kyx-check @@ -126,7 +126,7 @@ 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"])') + NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] | select (.rule_name=="deposit-limit-zero").measures=["form-info-internal-error"])') INVESTIGATE="true" ;; "none") @@ -139,7 +139,7 @@ in 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}\"])") + NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] | select (.rule_name=="deposit-limit-zero").measures=["form-${FORM}"])') INVESTIGATE="false" ;; esac @@ -147,12 +147,12 @@ esac # Finally, output the new rules. # See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlOutcome # for the required output format. -jq \ +jq -n \ --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)' + '{"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 @@ -109,7 +109,7 @@ 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 'del(.rules[] | select ((.rule_name=="kyc-rule-p2p-domestic-identification-requirement") || (.rule_name=="kyc-rule-withdraw-limit-low") ))') + NEW_RULES=$(echo "$CURRENT_RULES" | jq 'del(.rules[] | select ((.rule_name=="p2p-domestic-identification-requirement") or (.rule_name=="withdraw-limit-low") ))') else # Invalid country @@ -120,11 +120,12 @@ fi # Finally, output the new rules. # See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlOutcome # for the required output format. -jq \ +jq -n \ --argjson et "$EXPIRATION_TIME" \ --argjson sm "$SUCCESSOR_MEASURE" \ --argjson cm "$CUSTOM_MEASURES" \ --argjson nr "$NEW_RULES" \ - '{"new_rules":$nr+{"expiration_time":$et,"successor_measure":$sm,"custom_measures":($nr.custom_measures+$cm)}}|del(..|nulls)' + '{"new_rules":($nr+{"expiration_time":$et,"successor_measure":$sm,"custom_measures":($nr.custom_measures+$cm)})}|del(..|nulls)' +# FIXME: If we keep nr.custom_measures in "custom_measures", should we not ".del()" them from "new_rules"? exit 0 diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-sms-check b/src/kyclogic/taler-exchange-helper-measure-tops-sms-check @@ -18,8 +18,6 @@ # Hard error reporting on. set -eu - - # Exit, with error message (hard failure) function exit_fail() { echo " FAIL: " "$@" >&2 @@ -106,7 +104,7 @@ then # Valid phone number # Remove limitation from current rules. # 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") ))') + NEW_RULES=$(echo "$CURRENT_RULES" | jq 'del(.rules[] | select ((.rule_name=="p2p-domestic-identification-requirement") or (.rule_name=="withdraw-limit-low") ))') else # Invalid phone number @@ -114,14 +112,17 @@ else NEW_RULES="$CURRENT_RULES" fi + # Finally, output the new rules. # See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlOutcome # for the required output format. -jq \ + +jq -n \ --argjson et "$EXPIRATION_TIME" \ --argjson sm "$SUCCESSOR_MEASURE" \ --argjson cm "$CUSTOM_MEASURES" \ --argjson nr "$NEW_RULES" \ - '{"new_rules":$nr+{"expiration_time":$et,"successor_measure":$sm,"custom_measures":($nr.custom_measures+$cm)}}|del(..|nulls)' + '{"new_rules":($nr+{"expiration_time":$et,"successor_measure":$sm,"custom_measures":($nr.custom_measures+$cm)})}|del(..|nulls)' +# FIXME: If we keep nr.custom_measures in "custom_measures", should we not ".del()" them from "new_rules"? exit 0