[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: -add convenience function TALER_
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: -add convenience function TALER_EXCHANGE_keys_test_account_allowed |
Date: |
Thu, 02 Jan 2025 12:52:40 +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 b2d7bb32a -add convenience function
TALER_EXCHANGE_keys_test_account_allowed
b2d7bb32a is described below
commit b2d7bb32aa25f01b73b213f433147328e1f2c8a8
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Jan 2 12:52:30 2025 +0100
-add convenience function TALER_EXCHANGE_keys_test_account_allowed
---
src/include/taler_exchange_service.h | 22 ++++++++++++++++++++++
src/lib/Makefile.am | 2 +-
src/lib/exchange_api_common.c | 28 ++++++++++++++++++++++++++++
3 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/src/include/taler_exchange_service.h
b/src/include/taler_exchange_service.h
index d04324275..2e117a6ea 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1040,6 +1040,28 @@ TALER_EXCHANGE_test_account_allowed (
const struct TALER_NormalizedPayto payto_uri);
+/**
+ * Check if a wire transfer is allowed between the exchange
+ * and an account identified by @a payto_uri.
+ *
+ * @param keys exchange /keys response to check against
+ * @param check_credit true for credit (sending money
+ * to the exchange), false for debit (receiving money
+ * from the exchange)
+ * @param payto_uri other bank account (merchant, customer)
+ * @return
+ * #GNUNET_YES if the exchange would allow this
+ * #GNUNET_NO if this is not allowed
+ * #GNUNET_SYSERR if data in @a account is malformed
+ * or we experienced internal errors
+ */
+enum GNUNET_GenericReturnValue
+TALER_EXCHANGE_keys_test_account_allowed (
+ const struct TALER_EXCHANGE_Keys *keys,
+ bool check_credit,
+ const struct TALER_NormalizedPayto payto_uri);
+
+
/**
* Check the hard limits in @a keys for the given
* @a event and lower @a limit to the lowest applicable
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 4a10d9723..b7c86e849 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -18,7 +18,7 @@ lib_LTLIBRARIES = \
libtalerexchange.la
libtalerexchange_la_LDFLAGS = \
- -version-info 14:0:0 \
+ -version-info 15:0:1 \
-no-undefined
libtalerexchange_la_SOURCES = \
exchange_api_add_aml_decision.c \
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 175023f22..a751bdd71 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -651,4 +651,32 @@ TALER_EXCHANGE_free_accounts (
}
+enum GNUNET_GenericReturnValue
+TALER_EXCHANGE_keys_test_account_allowed (
+ const struct TALER_EXCHANGE_Keys *keys,
+ bool check_credit,
+ const struct TALER_NormalizedPayto payto_uri)
+{
+ /* For all accounts of the exchange */
+ for (unsigned int i = 0; i<keys->accounts_len; i++)
+ {
+ const struct TALER_EXCHANGE_WireAccount *account
+ = &keys->accounts[i];
+
+ /* KYC auth transfers are never supported with conversion */
+ if (NULL != account->conversion_url)
+ continue;
+ /* filter by source account by credit_restrictions */
+ if (GNUNET_YES !=
+ TALER_EXCHANGE_test_account_allowed (account,
+ check_credit,
+ payto_uri))
+ continue;
+ /* exchange account is allowed, add it */
+ return true;
+ }
+ return false;
+}
+
+
/* end of exchange_api_common.c */
--
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: -add convenience function TALER_EXCHANGE_keys_test_account_allowed,
gnunet <=