commit a5c9b6c4fcc256e23b3e530f002cb1a794d15be0
parent 99d75b86d4a7ca8c6affebcc227798ec0aca7245
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 22 Apr 2025 13:41:50 +0200
return kyc-required if we are still zero-lmited
Diffstat:
1 file changed, 55 insertions(+), 0 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c
@@ -528,6 +528,61 @@ map_to_status (const struct ExchangeKycRequest *ekr)
}
if (ekr->kyc_ok)
{
+ if (NULL != ekr->jlimits)
+ {
+ size_t off;
+ json_t *limit;
+ json_array_foreach (ekr->jlimits, off, limit)
+ {
+ struct TALER_Amount threshold;
+ enum TALER_KYCLOGIC_KycTriggerEvent operation_type;
+ bool soft = false;
+ struct GNUNET_JSON_Specification spec[] = {
+ TALER_JSON_spec_kycte ("operation_type",
+ &operation_type),
+ TALER_JSON_spec_amount_any ("threshold",
+ &threshold),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_bool ("soft_limit",
+ &soft),
+ NULL),
+ GNUNET_JSON_spec_end ()
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (limit,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break (0);
+ return "merchant-internal-error";
+ }
+ if (! TALER_amount_is_zero (&threshold))
+ continue; /* only care about zero-limits */
+ if (! soft)
+ continue; /* only care about soft limits */
+ if ( (operation_type == TALER_KYCLOGIC_KYC_TRIGGER_DEPOSIT) ||
+ (operation_type == TALER_KYCLOGIC_KYC_TRIGGER_AGGREGATE) ||
+ (operation_type == TALER_KYCLOGIC_KYC_TRIGGER_TRANSACTION) )
+ return "kyc-required";
+ }
+ }
+ if (NULL == ekr->jlimits)
+ {
+ /* check default limits */
+ const struct TALER_EXCHANGE_Keys *keys = ekr->keys;
+
+ for (unsigned int i = 0; i < keys->zero_limits_length; i++)
+ {
+ enum TALER_KYCLOGIC_KycTriggerEvent operation_type
+ = keys->zero_limits[i].operation_type;
+
+ if ( (operation_type == TALER_KYCLOGIC_KYC_TRIGGER_DEPOSIT) ||
+ (operation_type == TALER_KYCLOGIC_KYC_TRIGGER_AGGREGATE) ||
+ (operation_type == TALER_KYCLOGIC_KYC_TRIGGER_TRANSACTION) )
+ return "kyc-required";
+ }
+ }
return "ready";
}
if (! ekr->auth_ok)