exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

age_restriction_helper.c (1861B)


      1 /*
      2    This file is part of TALER
      3    Copyright (C) 2022- Taler Systems SA
      4 
      5    TALER is free software; you can redistribute it and/or modify it under the
      6    terms of the GNU General Public License as published by the Free Software
      7    Foundation; either version 3, or (at your option) any later version.
      8 
      9    TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11    A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12 
     13    You should have received a copy of the GNU General Public License along with
     14    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15  */
     16 /**
     17  * @file age_restriction_helper.c
     18  * @brief Helper functions for age restriction
     19  * @author Özgür Kesim
     20  */
     21 
     22 #include "taler/platform.h"
     23 #include "taler/taler_util.h"
     24 #include "taler/taler_signatures.h"
     25 #include "taler/taler_extensions.h"
     26 #include "stdint.h"
     27 
     28 
     29 const struct TALER_AgeRestrictionConfig *
     30 TALER_extensions_get_age_restriction_config ()
     31 {
     32   const struct TALER_Extension *ext;
     33 
     34   ext = TALER_extensions_get_by_type (TALER_Extension_AgeRestriction);
     35   if (NULL == ext)
     36     return NULL;
     37 
     38   return ext->config;
     39 }
     40 
     41 
     42 bool
     43 TALER_extensions_is_age_restriction_enabled ()
     44 {
     45   const struct TALER_Extension *ext;
     46 
     47   ext = TALER_extensions_get_by_type (TALER_Extension_AgeRestriction);
     48   if (NULL == ext)
     49     return false;
     50 
     51   return ext->enabled;
     52 }
     53 
     54 
     55 struct TALER_AgeMask
     56 TALER_extensions_get_age_restriction_mask ()
     57 {
     58   const struct TALER_Extension *ext;
     59   const struct TALER_AgeRestrictionConfig *conf;
     60 
     61   ext = TALER_extensions_get_by_type (TALER_Extension_AgeRestriction);
     62 
     63   if ((NULL == ext) ||
     64       (NULL == ext->config))
     65     return (struct TALER_AgeMask) {0}
     66   ;
     67 
     68   conf = ext->config;
     69   return conf->mask;
     70 }
     71 
     72 
     73 /* end age_restriction_helper.c */