merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 125dbecfcd035c21f0709b10205989e02d02f6a0
parent ba1d6d83c5789d4b6eb78002b9bbd4473c6b3f14
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  2 Apr 2026 01:19:22 +0200

do not clobber KYC state if exchange request merely timed out

Diffstat:
Msrc/backend/taler-merchant-kyccheck.c | 47+++++++++++++++++++++++++++++++++++++----------
1 file changed, 37 insertions(+), 10 deletions(-)

diff --git a/src/backend/taler-merchant-kyccheck.c b/src/backend/taler-merchant-kyccheck.c @@ -509,7 +509,6 @@ store_kyc_status ( i->jlimits = jlimits; GNUNET_break (! GNUNET_is_zero (&account_kyc_status->access_token)); i->access_token = account_kyc_status->access_token; - i->auth_ok = true; i->aml_review = account_kyc_status->aml_review; i->kyc_ok = (MHD_HTTP_OK == i->last_http_status); } @@ -535,21 +534,34 @@ exchange_check_cb ( if ( (i->last_http_status != ks->hr.http_status) && (0 != ks->hr.http_status) ) progress = true; - i->last_http_status = ks->hr.http_status; - i->last_ec = ks->hr.ec; + if (0 != ks->hr.http_status) + { + i->last_http_status = ks->hr.http_status; + i->last_ec = ks->hr.ec; + } GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "KYC status of `%s' at `%s' is %u\n", + "KYC status of `%s' / %s at `%s' is %u\n", i->a->merchant_account_uri.full_payto, + i->a->instance_id, i->e->keys->exchange_url, ks->hr.http_status); switch (ks->hr.http_status) { + case 0: + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Exchange did not responded to /kyc-check request!\n"); + i->backoff + = GNUNET_TIME_randomized_backoff (i->backoff, + EXCHANGE_TIMEOUT); + i->due = GNUNET_TIME_relative_to_absolute (i->backoff); + break; case MHD_HTTP_OK: if (i->rule_gen != ks->details.ok.rule_gen) progress = true; i->rule_gen = ks->details.ok.rule_gen; i->last_kyc_check = GNUNET_TIME_timestamp_get (); /* exchange says KYC is OK, gives status information */ + i->auth_ok = true; store_kyc_status (i, &ks->details.ok); i->backoff = GNUNET_TIME_UNIT_MINUTES; @@ -576,6 +588,7 @@ exchange_check_cb ( i->last_kyc_check = GNUNET_TIME_timestamp_get (); /* exchange says KYC is required */ + i->auth_ok = true; store_kyc_status (i, &ks->details.accepted); i->backoff = GNUNET_TIME_UNIT_MINUTES; @@ -680,7 +693,8 @@ exchange_check_cb ( return; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "account_kyc_set_status (%s, %u, %s, %s) returned %d\n", + "account_kyc_set_status (%s, %s, %u, %s, %s) returned %d\n", + i->a->instance_id, i->e->keys->exchange_url, i->last_http_status, i->auth_ok ? "auth OK" : "auth needed", @@ -734,10 +748,6 @@ inquiry_work (void *cls) return; } at_limit = false; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Starting KYC status of `%s' at `%s'\n", - i->a->merchant_account_uri.full_payto, - i->e->keys->exchange_url); i->timeout = GNUNET_TIME_relative_to_absolute (EXCHANGE_TIMEOUT); lpt = TALER_EXCHANGE_KLPT_NONE; @@ -748,7 +758,16 @@ inquiry_work (void *cls) else if (i->aml_review) lpt = TALER_EXCHANGE_KLPT_INVESTIGATION_DONE; if (! i->not_first_time) - lpt = TALER_EXCHANGE_KLPT_NONE; + lpt = TALER_EXCHANGE_KLPT_NONE; /* no long polling on 1st call */ + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Starting KYC status of `%s' for %s at `%s' (%d, %d, %d) using LPT %d\n", + i->a->merchant_account_uri.full_payto, + i->a->instance_id, + i->e->keys->exchange_url, + i->not_first_time, + i->auth_ok, + i->kyc_ok, + lpt); i->kyc = TALER_EXCHANGE_get_kyc_check_create ( ctx, i->e->keys->exchange_url, @@ -848,6 +867,14 @@ start_inquiry (struct Exchange *e, &i->backoff, &i->aml_review, &i->jlimits); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "account_kyc_get_status (%s, %s, %s) returned %d (%u, #%llu)\n", + i->a->instance_id, + e->keys->exchange_url, + a->merchant_account_uri.full_payto, + (int) qs, + i->last_http_status, + (unsigned long long) i->rule_gen); if (qs < 0) { GNUNET_break (0);