exchange

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

commit 77bb5cff8c834436062bba4284de588055bd3a94
parent bceed922d932287e66fe6d4538cbd21cb9208f06
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 30 Jun 2026 10:52:13 +0200

log only if DEBUG is on

Diffstat:
Msrc/kyclogic/plugin_kyclogic_kycaid.c | 29++++++++++++++++++++++++++++-
Msrc/kyclogic/plugin_kyclogic_persona.c | 48++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+), 1 deletion(-)

diff --git a/src/kyclogic/plugin_kyclogic_kycaid.c b/src/kyclogic/plugin_kyclogic_kycaid.c @@ -27,6 +27,7 @@ #include <regex.h> #include "taler/taler_util.h" +#define DEBUG 0 /** * Saves the state of a plugin. @@ -450,9 +451,11 @@ handle_initiate_finished (void *cls, NULL, NULL)) { GNUNET_break_op (0); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif ih->cb (ih->cb_cls, TALER_EC_EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY, NULL, @@ -481,9 +484,11 @@ handle_initiate_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "KYCAID failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif ih->cb (ih->cb_cls, TALER_EC_EXCHANGE_KYC_GENERIC_LOGIC_BUG, NULL, @@ -518,9 +523,11 @@ handle_initiate_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "KYCAID failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif ih->cb (ih->cb_cls, TALER_EC_EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY, NULL, @@ -551,9 +558,11 @@ handle_initiate_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unexpected KYCAID response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif ih->cb (ih->cb_cls, TALER_EC_EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY, NULL, @@ -821,9 +830,11 @@ log_failure (const json_t *verifications) NULL, NULL)) { GNUNET_break_op (0); +#if DEBUG json_dumpf (member, stderr, JSON_INDENT (2)); +#endif continue; } if (iverified) @@ -860,9 +871,11 @@ webhook_conversion_cb (void *cls, { /* No result, but *our helper* was OK => bad input */ GNUNET_break_op (0); +#if DEBUG json_dumpf (wh->json_response, stderr, JSON_INDENT (2)); +#endif resp = TALER_MHD_MAKE_JSON_PACK ( GNUNET_JSON_pack_uint64 ("kycaid_http_status", wh->kycaid_response_code), @@ -889,9 +902,11 @@ webhook_conversion_cb (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Helper exited with status code %d\n", (int) code); +#if DEBUG json_dumpf (wh->json_response, stderr, JSON_INDENT (2)); +#endif resp = TALER_MHD_MAKE_JSON_PACK ( GNUNET_JSON_pack_uint64 ("kycaid_http_status", wh->kycaid_response_code), @@ -918,9 +933,11 @@ webhook_conversion_cb (void *cls, /* Failure in our helper */ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Mandatory FORM_ID not set in result\n"); +#if DEBUG json_dumpf (result, stderr, JSON_INDENT (2)); +#endif resp = TALER_MHD_MAKE_JSON_PACK ( GNUNET_JSON_pack_uint64 ("kycaid_http_status", wh->kycaid_response_code), @@ -1071,9 +1088,11 @@ handle_webhook_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "KYCAID failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif resp = TALER_MHD_MAKE_JSON_PACK ( GNUNET_JSON_pack_uint64 ("kycaid_http_status", response_code)); @@ -1136,9 +1155,11 @@ handle_webhook_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "KYCAID failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif resp = TALER_MHD_MAKE_JSON_PACK ( GNUNET_JSON_pack_uint64 ("kycaid_http_status", response_code), @@ -1204,9 +1225,11 @@ handle_webhook_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unexpected KYCAID response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif wh->cb (wh->cb_cls, wh->process_row, &wh->h_payto, @@ -1334,7 +1357,7 @@ kycaid_webhook (void *cls, "KYCAID webhook of `%s' triggered with %s\n", pd->section, http_method); -#if 1 +#if DEBUG if (NULL != body) json_dumpf (body, stderr, @@ -1343,9 +1366,11 @@ kycaid_webhook (void *cls, if (NULL == pd) { GNUNET_break_op (0); +#if DEBUG json_dumpf (body, stderr, JSON_INDENT (2)); +#endif wh->resp = TALER_MHD_make_error ( TALER_EC_EXCHANGE_KYC_GENERIC_LOGIC_UNKNOWN, "kycaid"); @@ -1361,9 +1386,11 @@ kycaid_webhook (void *cls, NULL, NULL)) { GNUNET_break_op (0); +#if DEBUG json_dumpf (body, stderr, JSON_INDENT (2)); +#endif wh->resp = TALER_MHD_MAKE_JSON_PACK ( GNUNET_JSON_pack_object_incref ("webhook_body", (json_t *) body)); diff --git a/src/kyclogic/plugin_kyclogic_persona.c b/src/kyclogic/plugin_kyclogic_persona.c @@ -27,6 +27,8 @@ #include <regex.h> #include "taler/taler_util.h" +#define DEBUG 0 + /** * Which version of the persona API are we implementing? @@ -620,9 +622,11 @@ handle_initiate_finished (void *cls, const char *msg; GNUNET_break (0); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif msg = json_string_value ( json_object_get ( json_array_get ( @@ -646,9 +650,11 @@ handle_initiate_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Rate limiting requested:\n"); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif msg = json_string_value ( json_object_get ( json_array_get ( @@ -670,9 +676,11 @@ handle_initiate_finished (void *cls, char *err; GNUNET_break_op (0); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif GNUNET_asprintf (&err, "Unexpected HTTP status %u from Persona\n", (unsigned int) response_code); @@ -692,9 +700,11 @@ handle_initiate_finished (void *cls, if (NULL == data) { GNUNET_break_op (0); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif persona_initiate_cancel (ih); return; } @@ -706,9 +716,11 @@ handle_initiate_finished (void *cls, &eline)) { GNUNET_break_op (0); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif ih->cb (ih->cb_cls, TALER_EC_EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY, NULL, @@ -1051,9 +1063,11 @@ start_conversion (const struct TALER_KYCLOGIC_ProviderDetails *pd, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Calling converter `%s' with JSON\n", pd->conversion_binary); +#if DEBUG json_dumpf (attr, stderr, JSON_INDENT (2)); +#endif return TALER_JSON_external_conversion_start ( attr, cb, @@ -1305,9 +1319,11 @@ handle_proof_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "PERSONA failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif proof_reply_error ( ph, ph->inquiry_id, @@ -1369,9 +1385,11 @@ handle_proof_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "PERSONA failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif proof_reply_error ( ph, ph->inquiry_id, @@ -1392,9 +1410,11 @@ handle_proof_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "PERSONA failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif proof_reply_error ( ph, ph->inquiry_id, @@ -1415,9 +1435,11 @@ handle_proof_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "PERSONA failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif proof_reply_error ( ph, ph->inquiry_id, @@ -1438,9 +1460,11 @@ handle_proof_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "PERSONA failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif proof_reply_error ( ph, ph->inquiry_id, @@ -1653,9 +1677,11 @@ webhook_post_conversion_cb (void *cls, /* Failure in our helper */ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Mandatory FORM_ID not set in result\n"); +#if DEBUG json_dumpf (attr, stderr, JSON_INDENT (2)); +#endif resp = TALER_MHD_MAKE_JSON_PACK ( GNUNET_JSON_pack_uint64 ("persona_http_status", wh->persona_http_status), @@ -1736,9 +1762,11 @@ handle_webhook_finished (void *cls, "inquiry")) ) { GNUNET_break_op (0); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif webhook_reply_error (wh, inquiry_id, MHD_HTTP_BAD_GATEWAY); @@ -1767,9 +1795,11 @@ handle_webhook_finished (void *cls, NULL, NULL)) { GNUNET_break_op (0); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif webhook_reply_error (wh, inquiry_id, MHD_HTTP_BAD_GATEWAY); @@ -1827,9 +1857,11 @@ handle_webhook_finished (void *cls, if (NULL == account_id) { GNUNET_break_op (0); +#if DEBUG json_dumpf (data, stderr, JSON_INDENT (2)); +#endif webhook_reply_error (wh, inquiry_id, MHD_HTTP_BAD_GATEWAY); @@ -1860,9 +1892,11 @@ handle_webhook_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "PERSONA failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif webhook_reply_error (wh, wh->inquiry_id, MHD_HTTP_BAD_GATEWAY); @@ -1891,9 +1925,11 @@ handle_webhook_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "PERSONA failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif webhook_reply_error (wh, wh->inquiry_id, MHD_HTTP_GATEWAY_TIMEOUT); @@ -1903,9 +1939,11 @@ handle_webhook_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "PERSONA failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif webhook_reply_error (wh, wh->inquiry_id, MHD_HTTP_SERVICE_UNAVAILABLE); @@ -1915,9 +1953,11 @@ handle_webhook_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "PERSONA failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif webhook_reply_error (wh, wh->inquiry_id, MHD_HTTP_BAD_GATEWAY); @@ -1927,9 +1967,11 @@ handle_webhook_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "PERSONA failed with response %u:\n", (unsigned int) response_code); +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif webhook_reply_error (wh, wh->inquiry_id, MHD_HTTP_BAD_GATEWAY); @@ -2090,9 +2132,11 @@ persona_webhook (void *cls, if (NULL == wh->template_id) { GNUNET_break_op (0); +#if DEBUG json_dumpf (body, stderr, JSON_INDENT (2)); +#endif wh->resp = TALER_MHD_MAKE_JSON_PACK ( TALER_JSON_pack_ec ( TALER_EC_EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY), @@ -2111,9 +2155,11 @@ persona_webhook (void *cls, if (NULL == wh->pd) { GNUNET_break_op (0); +#if DEBUG json_dumpf (body, stderr, JSON_INDENT (2)); +#endif wh->resp = TALER_MHD_MAKE_JSON_PACK ( TALER_JSON_pack_ec ( TALER_EC_EXCHANGE_KYC_GENERIC_LOGIC_UNKNOWN), @@ -2143,9 +2189,11 @@ persona_webhook (void *cls, if (NULL == persona_inquiry_id) { GNUNET_break_op (0); +#if DEBUG json_dumpf (body, stderr, JSON_INDENT (2)); +#endif wh->resp = TALER_MHD_MAKE_JSON_PACK ( TALER_JSON_pack_ec ( TALER_EC_EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY),