[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: init json for account freeze
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: init json for account freeze |
Date: |
Mon, 06 Jan 2025 00:14:22 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new b8888d336 init json for account freeze
b8888d336 is described below
commit b8888d336d4332e0a6b9e1c1399b016f078b1df4
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jan 5 23:21:56 2025 +0100
init json for account freeze
---
src/exchange/taler-exchange-sanctionscheck.c | 76 +++++++++++++++++++++++++++-
1 file changed, 74 insertions(+), 2 deletions(-)
diff --git a/src/exchange/taler-exchange-sanctionscheck.c
b/src/exchange/taler-exchange-sanctionscheck.c
index 858f24aab..84ae02da9 100644
--- a/src/exchange/taler-exchange-sanctionscheck.c
+++ b/src/exchange/taler-exchange-sanctionscheck.c
@@ -308,6 +308,76 @@ account_cb (void *cls,
}
+/**
+ * Initialize JSON rules for freezing an account.
+ *
+ * @return true on success
+ */
+static bool
+init_freeze (void)
+{
+ char *currency;
+ struct TALER_Amount zero;
+ json_t *rules;
+ json_t *verboten;
+
+ if (GNUNET_OK !=
+ TALER_config_get_currency (cfg,
+ "exchange",
+ ¤cy))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "exchange",
+ "currency");
+ return false;
+ }
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (currency,
+ &zero));
+ verboten = json_array ();
+ GNUNET_assert (NULL != verboten);
+ GNUNET_assert (0 ==
+ json_array_append_new (verboten,
+ json_string ("verboten")));
+ rules = json_array ();
+ GNUNET_assert (NULL != rules);
+ for (enum TALER_KYCLOGIC_KycTriggerEvent et =
+ TALER_KYCLOGIC_KYC_TRIGGER_WITHDRAW;
+ et <= TALER_KYCLOGIC_KYC_TRIGGER_REFUND;
+ et++)
+ {
+ json_t *rule;
+
+ rule = GNUNET_JSON_PACK (
+ TALER_JSON_pack_kycte ("operation_type",
+ et),
+ TALER_JSON_pack_amount ("threshold",
+ &zero),
+ GNUNET_JSON_pack_time_rel ("timeframe",
+ GNUNET_TIME_UNIT_YEARS),
+ GNUNET_JSON_pack_array_incref ("measures",
+ verboten),
+ GNUNET_JSON_pack_uint64 ("display_priority",
+ 1),
+ GNUNET_JSON_pack_bool ("exposed",
+ false),
+ GNUNET_JSON_pack_bool ("is_and_combinator",
+ false));
+ GNUNET_assert (0 ==
+ json_array_append_new (rules,
+ rule));
+ }
+ json_decref (verboten);
+ freeze_rules =
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_timestamp ("expiration_time",
+ GNUNET_TIME_UNIT_FOREVER_TS),
+ GNUNET_JSON_pack_array_steal ("rules",
+ rules));
+ return true;
+}
+
+
/**
* First task.
*
@@ -328,7 +398,8 @@ run (void *cls,
(void) args;
(void) cfgfile;
cfg = c;
-
+ if (! init_freeze ())
+ return;
{
char *attr_enc_key_str;
@@ -416,7 +487,6 @@ main (int argc,
};
enum GNUNET_GenericReturnValue ret;
- freeze_rules = NULL; /* FIXME-#9053: set to JSON rules that freeze the
account */
ret = GNUNET_PROGRAM_run (
TALER_EXCHANGE_project_data (),
argc, argv,
@@ -425,6 +495,8 @@ main (int argc,
"process that checks all existing customer accounts against a sanctions
list"),
options,
&run, NULL);
+ json_decref (freeze_rules);
+ freeze_rules = NULL;
if (GNUNET_SYSERR == ret)
return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: init json for account freeze,
gnunet <=