merchant

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

commit fe93c459a665d46013c177d89f9df9df630836ab
parent e1d591f9f8a10d0b60e9ae2760321fe556b30b42
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri,  9 May 2025 14:29:39 +0200

fix #9892

Diffstat:
Msrc/backend/merchant.conf | 10++++++++++
Msrc/backend/taler-merchant-kyccheck.c | 48++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/src/backend/merchant.conf b/src/backend/merchant.conf @@ -59,3 +59,13 @@ WIRE_TRANSFER_DELAY = 3 week # How fast do we want customers to pay, i.e. how long will our # proposal be valid? DEFAULT_PAY_DEADLINE = 1 day + +[merchant-kyccheck] + +# How long do we wait between AML status requests to the +# exchange if we expect a status change? +AML_FREQ = 6h + +# How long do we wait between AML status requests to the +# exchange if we do not expect any AML status changes? +AML_LOW_FREQ = 7d diff --git a/src/backend/taler-merchant-kyccheck.c b/src/backend/taler-merchant-kyccheck.c @@ -43,21 +43,37 @@ /** * How long do we wait between requests if all we wait * for is a change in the AML investigation status? + * Default value. */ #define AML_FREQ GNUNET_TIME_relative_multiply ( \ GNUNET_TIME_UNIT_HOURS, \ 6) /** + * How long do we wait between requests if all we wait + * for is a change in the AML investigation status? + */ +static struct GNUNET_TIME_Relative aml_freq; + +/** * How frequently do we check for updates to our KYC status * if there is no actual reason to check? Set to a very low * frequency, just to ensure we eventually notice. + * Default value. */ #define AML_LOW_FREQ GNUNET_TIME_relative_multiply ( \ GNUNET_TIME_UNIT_DAYS, \ 7) /** + * How frequently do we check for updates to our KYC status + * if there is no actual reason to check? Set to a very low + * frequency, just to ensure we eventually notice. + */ +static struct GNUNET_TIME_Relative aml_low_freq; + + +/** * How many inquiries do we process concurrently at most. */ #define OPEN_INQUIRY_LIMIT 1024 @@ -526,12 +542,12 @@ exchange_check_cb ( if (i->aml_review || i->zero_limited) { if (! progress) - i->due = GNUNET_TIME_relative_to_absolute (AML_FREQ); + i->due = GNUNET_TIME_relative_to_absolute (aml_freq); } else { /* KYC is OK, only check again if triggered */ - i->due = GNUNET_TIME_relative_to_absolute (AML_LOW_FREQ); + i->due = GNUNET_TIME_relative_to_absolute (aml_low_freq); } break; case MHD_HTTP_ACCEPTED: @@ -558,7 +574,7 @@ exchange_check_cb ( json_decref (i->jlimits); i->jlimits = NULL; /* KYC is OK, only check again if triggered */ - i->due = GNUNET_TIME_relative_to_absolute (AML_LOW_FREQ); + i->due = GNUNET_TIME_relative_to_absolute (aml_low_freq); break; case MHD_HTTP_FORBIDDEN: /* bad signature */ i->last_kyc_check = GNUNET_TIME_timestamp_get (); @@ -827,7 +843,7 @@ start_inquiry (struct Exchange *e, /* KYC is OFF, only check again if triggered */ if (GNUNET_YES != test_mode) { - i->due = GNUNET_TIME_relative_to_absolute (AML_LOW_FREQ); + i->due = GNUNET_TIME_relative_to_absolute (aml_low_freq); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "KYC was disabled, randomizing inquiry to start at %s\n", GNUNET_TIME_absolute2s (i->due)); @@ -1409,6 +1425,30 @@ run (void *cls, (void) cfgfile; cfg = c; + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_time (cfg, + "merchant-kyccheck", + "AML_FREQ", + &aml_freq)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, + "merchant-kyccheck", + "AML_FREQ"); + /* use default */ + aml_freq = AML_FREQ; + } + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_time (cfg, + "merchant-kyccheck", + "AML_LOW_FREQ", + &aml_freq)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, + "merchant-kyccheck", + "AML_LOW_FREQ"); + /* use default */ + aml_low_freq = AML_LOW_FREQ; + } GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,