exchange

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

commit 4ec0eca6fc70a57ab1d7d701596e7122b06648cc
parent d4a179ec064367e0fffc3c688abdade29a81be27
Author: Sebastian <sebasjm@gmail.com>
Date:   Mon, 10 Nov 2025 12:53:58 -0300

fix #10413

jproperties returned text and coalesce can't be used with mixed types -> casting to ::bool
legitimication_outcomes -> legitimization_outcomes
on -> using
lo.h_payto -> wt.h_normalized_payto
missing ending )

GNUNET_TIME_UNIT_ZERO_TS on close_time converts to null on GNUNET_JSON_pack_timestamp -> using never


Diffstat:
Msrc/exchange/taler-exchange-httpd_aml-accounts-get.c | 8++++----
Msrc/exchangedb/pg_select_kyc_accounts.c | 30+++++++++++++++---------------
2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_aml-accounts-get.c b/src/exchange/taler-exchange-httpd_aml-accounts-get.c @@ -260,8 +260,8 @@ record_cb ( abs_time) ? "-" : GNUNET_TIME_timestamp2s (open_time), - GNUNET_TIME_absolute_is_zero (close_time. - abs_time) + GNUNET_TIME_absolute_is_never (close_time. + abs_time) ? "-" : GNUNET_TIME_timestamp2s (close_time)); GNUNET_free (ecomments); @@ -307,8 +307,8 @@ record_cb ( abs_time) ? "-" : otbuf, - GNUNET_TIME_absolute_is_zero (close_time. - abs_time) + GNUNET_TIME_absolute_is_never (close_time. + abs_time) ? "-" : ctbuf); GNUNET_free (ecomments); diff --git a/src/exchangedb/pg_select_kyc_accounts.c b/src/exchangedb/pg_select_kyc_accounts.c @@ -77,7 +77,7 @@ handle_kyc_account_result (void *cls, struct GNUNET_TIME_Timestamp open_time = GNUNET_TIME_UNIT_FOREVER_TS; struct GNUNET_TIME_Timestamp close_time - = GNUNET_TIME_UNIT_ZERO_TS; + = GNUNET_TIME_UNIT_FOREVER_TS; bool to_investigate; bool high_risk; struct TALER_FullPayto payto; @@ -181,21 +181,21 @@ TEH_PG_select_kyc_accounts ( ",lo.jproperties ->> 'FILE_NOTE' AS comments" ",lo.jproperties ->> 'open_date' AS open_time" ",COALESCE(lo.to_investigate,FALSE) AS to_investigate" - ",COALESCE(lo.jproperties ->> 'HIGH_RISK_CUSTOMER',FALSE) AS high_risk" + ",COALESCE((lo.jproperties ->> 'HIGH_RISK_CUSTOMER')::bool,FALSE) AS high_risk" ",wt.payto_uri" " FROM kyc_targets kt" " JOIN wire_targets wt" + " ON (wt.h_normalized_payto = kt.h_normalized_payto)" + " LEFT JOIN legitimization_outcomes lo" " ON (lo.h_payto = kt.h_normalized_payto)" - " LEFT JOIN legitimication_outcomes lo" - " USING (lo.h_payto = kt.h_normalized_payto)" " WHERE (kyc_target_serial_id > $1)" // select most recent outcomes only " AND COALESCE (lo.is_active, TRUE)" - " AND ($3 OR (COALESCE(lo.to_investigate,FALSE) == $4))" + " AND ($3 OR (COALESCE(lo.to_investigate,FALSE) = $4))" // Account is open if we had an AML outcome - " AND ($5 OR ((lo.outcome_serial_id IS NULL) == $6))" - " AND ($7 OR ((COALESCE(lo.jproperties ->>'high_risk',FALSE) == $8))" - " ORDER BY lo.kyc_target_serial_id ASC" + " AND ($5 OR ((lo.outcome_serial_id IS NULL) = $6))" + " AND ($7 OR ((COALESCE((lo.jproperties ->>'high_risk')::bool,FALSE) = $8)))" + " ORDER BY kt.kyc_target_serial_id ASC" " LIMIT $2"); PREPARE (pg, "select_kyc_accounts_dec", @@ -207,21 +207,21 @@ TEH_PG_select_kyc_accounts ( ",lo.jproperties ->> 'FILE_NOTE' AS comments" ",lo.jproperties ->> 'open_date' AS open_time" ",COALESCE(lo.to_investigate,FALSE) AS to_investigate" - ",COALESCE(lo.jproperties ->> 'HIGH_RISK_CUSTOMER',FALSE) AS high_risk" + ",COALESCE((lo.jproperties ->> 'HIGH_RISK_CUSTOMER')::bool,FALSE) AS high_risk" ",wt.payto_uri" " FROM kyc_targets kt" " JOIN wire_targets wt" + " ON (wt.h_normalized_payto = kt.h_normalized_payto)" + " LEFT JOIN legitimization_outcomes lo" " ON (lo.h_payto = kt.h_normalized_payto)" - " LEFT JOIN legitimication_outcomes lo" - " USING (lo.h_payto = kt.h_normalized_payto)" " WHERE (kyc_target_serial_id < $1)" // select most recent outcomes only " AND COALESCE (lo.is_active, TRUE)" - " AND ($3 OR (COALESCE(lo.to_investigate,FALSE) == $4))" + " AND ($3 OR (COALESCE(lo.to_investigate,FALSE) = $4))" // Account is open if we had an AML outcome - " AND ($5 OR ((lo.outcome_serial_id IS NULL) == $6))" - " AND ($7 OR ((COALESCE(lo.jproperties ->>'high_risk',FALSE) == $8))" - " ORDER BY lo.kyc_target_serial_id DESC" + " AND ($5 OR ((lo.outcome_serial_id IS NULL) = $6))" + " AND ($7 OR ((COALESCE((lo.jproperties ->>'high_risk')::bool,FALSE) = $8)))" + " ORDER BY kt.kyc_target_serial_id DESC" " LIMIT $2"); qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, stmt,