commit 1f935754bdf37f8eae5bce85283e3b3dad7eb128
parent da2e3961570f9f4da8bd20ddb8d5c581131412f4
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 8 Sep 2024 10:16:25 +0200
add notification on KYC rule trigger
Diffstat:
1 file changed, 34 insertions(+), 0 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -1040,6 +1040,39 @@ handle_batch_deposit_ok (struct ExchangeGroup *eg,
/**
+ * Notify taler-merchant-kyccheck that we got a KYC
+ * rule violation notification and should start to
+ * check our KYC status.
+ *
+ * @param eg exchange group we were notified for
+ */
+static void
+notify_kyc_required (const struct ExchangeGroup *eg)
+{
+ struct GNUNET_DB_EventHeaderP es = {
+ .size = htons (sizeof (es)),
+ .type = htons (TALER_DBEVENT_MERCHANT_EXCHANGE_KYC_RULE_TRIGGERED)
+ };
+ char *hws;
+ char *extra;
+
+ hws = GNUNET_STRINGS_data_to_string_alloc (
+ &eg->pc->h_wire,
+ sizeof (eg->pc->h_wire));
+ GNUNET_asprintf (&extra,
+ "%s %s",
+ hws,
+ eg->exchange_url);
+ GNUNET_free (hws);
+ TMH_db->event_notify (TMH_db->cls,
+ &es,
+ extra,
+ strlen (extra) + 1);
+ GNUNET_free (extra);
+}
+
+
+/**
* Callback to handle a batch deposit permission's response.
*
* @param cls a `struct ExchangeGroup`
@@ -1071,6 +1104,7 @@ batch_deposit_cb (
}
return;
case MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS:
+ notify_kyc_required (eg);
eg->got_451 = true;
pc->got_451 = true;
/* update pc->pending */