aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-09-08 10:16:25 +0200
committerChristian Grothoff <christian@grothoff.org>2024-09-08 10:16:25 +0200
commit1f935754bdf37f8eae5bce85283e3b3dad7eb128 (patch)
tree36b40e74f960e608f704f43728c01b512f8739f1
parentda2e3961570f9f4da8bd20ddb8d5c581131412f4 (diff)
add notification on KYC rule trigger
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-pay.c34
1 files 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
index 36fa7e7f..59519206 100644
--- 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 */