cash2ecash

cash2ecash: cash acceptor that issues digital cash (experimental)
Log | Files | Refs | README | LICENSE

bank_api_get_config.h (5222B)


      1 /*
      2   This file is part of TALER cash2ecash
      3   Copyright (C) 2026 GNUnet e.V.
      4 
      5   This program is free software: you can redistribute it and/or modify
      6   it under the terms of the GNU Affero General Public License as
      7   published by the Free Software Foundation, either version 3 of the
      8   License, or (at your option) any later version.
      9 
     10   This program is distributed in the hope that it will be useful,
     11   but WITHOUT ANY WARRANTY; without even the implied warranty of
     12   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14   GNU Affero General Public License for more details.
     15 
     16   You should have received a copy of the GNU Affero General Public License
     17   along with this program.  If not, see <https://www.gnu.org/licenses/>.
     18 */
     19 
     20 /**
     21  * @file bank_api_get_config.h
     22  * @brief Implementation of the GET /config request of the bank's HTTP API
     23  * @author Reto Tellenbach
     24  */
     25 
     26 #ifndef BANK_API_GET_CONFIG_H
     27 #define BANK_API_GET_CONFIG_H
     28 
     29 #include "bank_api_curl_defaults.h"
     30 #include "../taler/taler_digitizer_service.h"
     31 
     32 /**
     33  * Handle for the get config request.
     34  */
     35 struct TALER_BANK_GetConfigHandle;
     36 
     37 /**
     38  * @brief Information we get from the bank about itself. and is needed for the digitizer
     39  */
     40 struct TALER_BANK_ConfigInformation
     41 {
     42 
     43   /**
     44    * Supported Taler protocol version by the bank.
     45    * String in the format current:revision:age using the
     46    * semantics of GNU libtool.  See
     47    * https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
     48    */
     49   const char *version;
     50 
     51   /**
     52    * Currency used by this bank.
     53    */
     54   const char *currency;
     55 
     56   /**
     57    * Minimum wire transfer amount allowed. Only applies to bank transactions and withdrawals.
     58    */
     59   struct TALER_Amount min_wire_transfer_amount;
     60 
     61   /**
     62    * Maximum wire transfer amount allowed. Only applies to bank transactions and withdrawals.
     63   */
     64   struct TALER_Amount max_wire_transfer_amount;
     65 
     66   /**
     67    * How the bank SPA should render this currency.
     68    */
     69   struct TALER_CurrencySpecification currency_specification;
     70 
     71     /**
     72    * Bank display name to be used in user interfaces.
     73    * For consistency use "Taler Bank" if missing.
     74    */
     75   const char *bank_name;
     76 
     77   /**
     78    * Wire transfer execution fees. Only applies to bank transactions and withdrawals.
     79    */
     80   struct TALER_Amount wire_transfer_fees;
     81 
     82   // /**
     83   //  * Name of api
     84   //  */
     85   // const char *api_name;
     86 
     87 
     88   // /**
     89   //  * Advertised base URL to use when you sharing an URL with another program.
     90   //  */
     91   // const char *base_url;
     92 
     93   // /** If 'true' the server provides local currency conversion support
     94   //  * If 'false' some parts of the API are not supported and return 501
     95   //  */
     96   // const bool allow_conversion;
     97 
     98   // /** If 'true' anyone can register
     99   //  * If 'false' only admin can
    100   //  */
    101   // const bool allow_registrations;
    102 
    103   // /**
    104   //  * If 'true' account can delete themselves
    105   //  * If 'false' only admin can delete accounts
    106   // */
    107   // const bool allow_deletions;
    108 
    109   // /**
    110   //  * If 'true' anyone can edit their name
    111   //  * If 'false' only admin can
    112   //  */
    113   // const bool allow_edit_name;
    114 
    115   // /**
    116   //  * If 'true' anyone can edit their cashout account
    117   //  * If 'false' only admin can
    118   //  */
    119   // const bool allow_edit_cashout_payto_uri;
    120 
    121   // /**
    122   //  * Default debt limit for newly created accounts
    123   //  */
    124   // const struct TALER_AmountNBO default_debit_threshold; 
    125 
    126   // /**
    127   //  * Stand in  string for the TAN channel. Not used in the callbacks
    128   //  * when used needs to be addapted
    129   //  * TAN channels supported by the server
    130   //  */
    131   // const char *supported_tan_channels;
    132 
    133   // /**
    134   //  * Wire transfer type supported by the bank.
    135   //  * Defaults to 'iban' is missing
    136   //  */
    137   // const char *wire_type;
    138 
    139 };
    140 
    141 /**
    142  * Response details for a config request
    143  */
    144 struct TALER_BANK_ConfigResponse
    145 {
    146 
    147   /**
    148    * HTTP response
    149    */
    150   struct TALER_BANK_HttpResponse hr;
    151 
    152   /**
    153    * Details returned depending on the @e http_status.
    154    */
    155   union
    156   {
    157 
    158     /**
    159      * Details if status was request was succesfull
    160      */
    161     struct
    162     {
    163 
    164       /**
    165        * Protocol compatibility evaluation.
    166        */
    167       enum TALER_BANK_VersionCompatibility version_compa;
    168 
    169       /**
    170        * Config data returned by /config.
    171        */
    172       struct TALER_BANK_ConfigInformation configi;
    173 
    174     } ok;
    175 
    176   } details;
    177 
    178 };
    179 
    180 
    181 /**
    182  * Function called with information about the bank.
    183  *
    184  * @param cls closure
    185  * @param vr response data
    186  */
    187 typedef void
    188 (*TALER_BANK_ConfigCallback) (
    189   void *cls,
    190   const struct TALER_BANK_ConfigResponse *vr);
    191 
    192 
    193 /**
    194  * Handle for the get config request.
    195  */
    196 struct TALER_BANK_GetConfigHandle;
    197 
    198 
    199 /**
    200  * Obtain config inforamtion about the connected Bank
    201  * @param ctx
    202  * @param url
    203  * @return NULL on failure
    204  */
    205 struct TALER_BANK_GetConfigHandle *
    206 TALER_BANK_get_config ( struct GNUNET_CURL_Context *ctx,
    207                         const char *url,
    208                         TALER_BANK_ConfigCallback config_cb,
    209                         void *config_cb_cls);
    210 
    211 /**
    212  * Cancel config request. Handles the GNUNet canelation.
    213  */
    214 void
    215 TALER_BANK_get_config_cancel ( struct TALER_BANK_GetConfigHandle *bank);
    216 
    217 
    218 #endif //BANK_API_GET_CONFIG_H