diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_exchanges.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_exchanges.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c index 918bc48f..6bcbd5c8 100644 --- a/src/backend/taler-merchant-httpd_exchanges.c +++ b/src/backend/taler-merchant-httpd_exchanges.c @@ -1651,6 +1651,35 @@ update_exchange_keys (void *cls, } +bool +TMH_EXCHANGES_is_below_limit ( + const struct TALER_EXCHANGE_Keys *keys, + enum TALER_KYCLOGIC_KycTriggerEvent operation_type, + const struct TALER_Amount *amount) +{ + if (NULL == keys) + { + /* should only be called after we have keys! */ + GNUNET_break (0); + return false; + } + for (unsigned int i = 0; i<keys->hard_limits_length; i++) + { + const struct TALER_EXCHANGE_AccountLimit *al + = &keys->hard_limits[i]; + + if (operation_type != al->operation_type) + continue; + if (-1 == + TALER_amount_cmp (&al->threshold, + amount)) + /* -1: threshold < amount */ + return false; + } + return true; +} + + enum GNUNET_GenericReturnValue TMH_EXCHANGES_init (const struct GNUNET_CONFIGURATION_Handle *cfg) { |