commit 081d639e6290664a856da47aadaebfa973d11e3e
parent 3cb0fe94412ef3b737cbe34be4dd144dd60392fa
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 14 Apr 2025 21:55:50 +0200
improve logging, fix AML helpers, improve indentation
Diffstat:
8 files changed, 65 insertions(+), 49 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_common_kyc.c b/src/exchange/taler-exchange-httpd_common_kyc.c
@@ -377,12 +377,21 @@ TEH_kyc_run_measure_for_attributes (
TEH_kyc_run_measure_cancel (kat);
return NULL;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "No active legitimization for %llu\n",
+ (unsigned long long) process_row);
TEH_kyc_run_measure_cancel (kat);
return NULL;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Running AML program on for current measures\n");
+ json_dumpf (kat->jmeasures,
+ stderr,
+ JSON_INDENT (2));
+ fprintf (stderr,
+ "\n");
{
struct TALER_EXCHANGEDB_HistoryBuilderContext hbc = {
.account = &kat->account_id,
diff --git a/src/exchange/taler-exchange-httpd_kyc-proof.c b/src/exchange/taler-exchange-httpd_kyc-proof.c
@@ -237,9 +237,10 @@ proof_finish (
GNUNET_break (5 != kpc->response_code / 100);
GNUNET_assert (kpc->response_code != UINT_MAX);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Templating error response for %d and HTTP status %u\n",
+ "Templating error response for %d and HTTP status %u (%s)\n",
(int) ec,
- kpc->response_code);
+ kpc->response_code,
+ detail);
kpc->response = make_html_error (
kpc->rc->connection,
"kyc-proof-internal-error",
@@ -355,7 +356,7 @@ proof_cb (
proof_finish (kpc,
TALER_EC_GENERIC_DB_STORE_FAILED,
"kyc_store_attributes");
- return;
+ break;
}
kpc->kat = TEH_kyc_run_measure_for_attributes (
@@ -366,10 +367,10 @@ proof_cb (
kpc);
if (NULL == kpc->kat)
{
- GNUNET_break (0);
+ GNUNET_break_op (0);
proof_finish (kpc,
- TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION,
- "[exchange] AML_KYC_TRIGGER");
+ TALER_EC_EXCHANGE_KYC_PROOF_REQUEST_UNKNOWN,
+ NULL);
}
break;
case TALER_KYCLOGIC_STATUS_FAILED:
@@ -397,35 +398,31 @@ proof_cb (
TALER_EC_EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY,
msg);
GNUNET_free (msg);
+ break;
}
- else
+ if (! TEH_kyc_failed (
+ kpc->process_row,
+ &kpc->h_payto,
+ kpc->provider_name,
+ provider_user_id,
+ provider_legitimization_id,
+ TALER_KYCLOGIC_status2s (status),
+ TALER_EC_EXCHANGE_GENERIC_KYC_FAILED))
{
- if (! TEH_kyc_failed (
- kpc->process_row,
- &kpc->h_payto,
- kpc->provider_name,
- provider_user_id,
- provider_legitimization_id,
- TALER_KYCLOGIC_status2s (status),
- TALER_EC_EXCHANGE_GENERIC_KYC_FAILED))
- {
- GNUNET_break (0);
- proof_finish (
- kpc,
- TALER_EC_GENERIC_DB_STORE_FAILED,
- "TEH_kyc_failed");
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "KYC process #%llu failed with status %d\n",
- (unsigned long long) kpc->process_row,
- status);
- proof_finish (kpc,
- TALER_EC_NONE,
- NULL);
- }
+ GNUNET_break (0);
+ proof_finish (
+ kpc,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
+ "TEH_kyc_failed");
+ break;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "KYC process #%llu failed with status %d\n",
+ (unsigned long long) kpc->process_row,
+ status);
+ proof_finish (kpc,
+ TALER_EC_NONE,
+ NULL);
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c
@@ -3990,7 +3990,8 @@ handle_aml_output (
aprh->async_cb = NULL;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "AML program output is:\n");
+ "AML program %s output is:\n",
+ aprh->program->program_name);
json_dumpf (result,
stderr,
JSON_INDENT (2));
@@ -4000,6 +4001,11 @@ handle_aml_output (
if ( (GNUNET_OS_PROCESS_EXITED != status_type) ||
(0 != code) )
{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "AML program %s returned non-zero status %d/%d\n",
+ aprh->program->program_name,
+ (int) status_type,
+ (int) code);
apr->status = TALER_KYCLOGIC_AMLR_FAILURE;
apr->details.failure.fallback_measure
= fallback_measure;
diff --git a/src/kyclogic/taler-exchange-helper-measure-defaults-but-investigate b/src/kyclogic/taler-exchange-helper-measure-defaults-but-investigate
@@ -64,7 +64,7 @@ do
exit 0
;;
v)
- echo "$0 v0.0.0"
+ echo "$0 v0.0.1"
exit 0
;;
V)
@@ -91,5 +91,6 @@ DEFAULT_RULES=$(jq '.default_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}'
+exec jq -n \
+ --argjson dr "$DEFAULT_RULES" \
+ '{"new_rules":$dr,"to_investigate":true}'
diff --git a/src/kyclogic/taler-exchange-helper-measure-freeze b/src/kyclogic/taler-exchange-helper-measure-freeze
@@ -63,7 +63,7 @@ do
exit 0
;;
v)
- echo "$0 v0.0.0"
+ echo "$0 v0.0.1"
exit 0
;;
V)
diff --git a/src/kyclogic/taler-exchange-helper-measure-inform-investigate b/src/kyclogic/taler-exchange-helper-measure-inform-investigate
@@ -96,5 +96,6 @@ NEW_RULES=$(echo "$CURRENT_RULES" | jq '(.rules[] |= if (.rule_name=="deposit-li
# See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlOutcome
# for the required output format.
-echo "$NEW_RULES" \
- | jq '.+{"to_investigate": true}'
+exec jq -n \
+ --argjson nr "$NEW_RULES" \
+ '{"new_rules":$nr,"to_investigate":true}'
diff --git a/src/kyclogic/taler-exchange-helper-measure-preserve-but-investigate b/src/kyclogic/taler-exchange-helper-measure-preserve-but-investigate
@@ -64,7 +64,7 @@ do
exit 0
;;
v)
- echo "$0 v0.0.0"
+ echo "$0 v0.0.1"
exit 0
;;
V)
@@ -91,5 +91,6 @@ CURRENT_RULES=$(jq '.current_rules')
# See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlOutcome
# for the required output format.
-echo "$CURRENT_RULES" \
- | jq '.+{"to_investigate": true}'
+exec jq -n \
+ --argjson cr "$CURRENT_RULES" \
+ '{"new_rules":$cr,"to_investigate":true}'
diff --git a/src/kyclogic/taler-exchange-helper-measure-tops-sms-check b/src/kyclogic/taler-exchange-helper-measure-tops-sms-check
@@ -106,11 +106,12 @@ then
# Remove test rules that should now be satisfied
NEW_RULES=$(echo "$NEW_RULES" | jq 'del(.rules[] | select (.rule_name=="balance-testing-limit1") )')
-
+ TO_INVESTIGATE="false"
else
# Invalid phone number
- echo "Phone number ${PHONE_NUMBER} invalid." 1&>2
- NEW_RULES="$CURRENT_RULES"
+ echo "Phone number ${PHONE_NUMBER} invalid." 1>&2
+ NEW_RULES=$(echo $CURRENT_RULES | jq '.+{"to_investigate": true}')
+ TO_INVESTIGATE="true"
fi
@@ -118,12 +119,12 @@ fi
# See https://docs.taler.net/taler-kyc-manual.html#tsref-type-AmlOutcome
# for the required output format.
-jq -n \
+exec 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)'
+ --argjson inv "$TO_INVESTIGATE" \
+ '{"new_rules":($nr+{"expiration_time":$et,"successor_measure":$sm,"custom_measures":({}+$nr.custom_measures+$cm)}),"to_investigate":$inv}|del(..|nulls)'
# FIXME: If we keep nr.custom_measures in "custom_measures", should we not ".del()" them from "new_rules"?
-exit 0