exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit f82783075230d4ac2be1a175331f15b54a876606
parent 7fdb5ac1332961eb25173077e69eb2bf92981f67
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 13 Apr 2025 22:50:23 +0200

filter duplicate KYC requirements from /kyc-info endpoint

Diffstat:
Msrc/exchange/taler-exchange-httpd_kyc-info.c | 23+++++++++++++++++++++++
Msrc/kyclogic/kyclogic_api.c | 9++++++++-
Msrc/kyclogic/taler-exchange-helper-measure-tops-address-check | 5++++-
Msrc/kyclogic/taler-exchange-helper-measure-tops-sms-check | 5++++-
4 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_kyc-info.c b/src/exchange/taler-exchange-httpd_kyc-info.c @@ -407,6 +407,29 @@ resume_with_reply (struct KycPoller *kyp, "could not convert measure to requirement"); return; } + /* Check if requirement is a duplicate, and in that case do + not return it */ + { + size_t off; + json_t *have; + bool duplicate = false; + + json_array_foreach (kris, off, have) + { + if (1 == json_equal (have, + kri)) + { + /* Duplicate requirement, do not return again */ + duplicate = true; + break; + } + } + if (duplicate) + { + json_decref (kri); + continue; + } + } GNUNET_assert (0 == json_array_append_new (kris, kri)); diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c @@ -702,7 +702,8 @@ TALER_KYCLOGIC_rules_parse (const json_t *jlrs) GNUNET_break (0); goto cleanup; } - if (0 == strcasecmp (str, KYC_MEASURE_IMPOSSIBLE)) + if (0 == strcasecmp (str, + KYC_MEASURE_IMPOSSIBLE)) { rule->verboten = true; } @@ -2887,7 +2888,13 @@ TALER_KYCLOGIC_kyc_init ( if (0 == strcmp (KYC_MEASURE_IMPOSSIBLE, measure_name)) + { + GNUNET_assert ( + 0 == + json_array_append_new (jmeasures, + json_string (KYC_MEASURE_IMPOSSIBLE))); continue; + } m = find_measure (&default_rules, measure_name); if (NULL == m) diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-address-check b/src/kyclogic/taler-exchange-helper-measure-tops-address-check @@ -135,7 +135,10 @@ CUSTOM_MEASURES=$(jq -n \ '{"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[] |= if (.rule_name=="deposit-limit-zero") then .measures=["custom-address-investigation"] else . end)' | jq --argjson cm "$CUSTOM_MEASURES" '.custom_measures=$cm') +NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] |= if (.measures[0]=="kyx") then .measures=["custom-address-investigation"] else . end)' | jq --argjson cm "$CUSTOM_MEASURES" '.custom_measures=$cm') + +# Remove test rules that should now be satisfied +NEW_RULES=$(echo "$NEW_RULES" | jq 'del(.rules[] | select (.rule_name=="balance-testing-limit1") )') # 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-sms-check b/src/kyclogic/taler-exchange-helper-measure-tops-sms-check @@ -101,9 +101,12 @@ if $(echo "$PHONE_NUMBER" | grep -E -e ${EXCHANGE_AML_PROGRAM_TOPS_SMS_CHECK_REG 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=="p2p-domestic-identification-requirement") or (.rule_name=="withdraw-limit-low") ))') + # Remove test rules that should now be satisfied +NEW_RULES=$(echo "$NEW_RULES" | jq 'del(.rules[] | select (.rule_name=="balance-testing-limit1") )') + + else # Invalid phone number echo "Phone number ${PHONE_NUMBER} invalid." 1&>2