bank_api_get_accounts.h (3740B)
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 * @file lib/bank_api_get_accounts.h 21 * @brief implements the Taler Bank API "GET accounts/$USERNAME" handler 22 * @author Reto Tellenbach 23 */ 24 #ifndef BANK_API_GET_ACCOUNTS_H 25 #define BANK_API_GET_ACCOUNTS_H 26 27 #include "api_common.h" 28 29 30 /** 31 * @brief Information we get from the bank about itself 32 * and is needed for the digitizer 33 */ 34 struct TALER_BANK_AccountInformation 35 { 36 /** 37 * Available balance on the account. 38 */ 39 struct TALER_BANK_Balance balance; 40 41 /** 42 * Number indicating the max debit allowed 43 * for the requesting user. 44 */ 45 struct TALER_Amount debit_threshold; 46 47 /** 48 * aray of tan channels 49 * posible channel @e TEH_TanChannelOptions 50 * enabled channels for 2FA 51 * can be empty 52 */ 53 char *tan_channels[TMH_TCS_OPTIONS_COUNT]; 54 55 /** 56 * Addresses where to send the TAN for transactions. 57 */ 58 struct TALER_BANK_ChallengeContactData contact_data; 59 60 /** 61 * Current status of the account 62 * active: the account can be used 63 * locked: the account can be used but cannot create new tokens 64 * deleted: the account has been deleted but is retained for compliance 65 */ 66 const char *status; 67 68 /** 69 * Conversion rate class of the user 70 * Only present if conversion is activated on the server 71 * 72 */ 73 uint32_t conversion_rate_class_id; 74 }; 75 76 /** 77 * Response details for a accounts/$USERNAME request 78 */ 79 struct TALER_BANK_AccountsResponse 80 { 81 82 /** 83 * HTTP response 84 */ 85 struct TALER_BANK_HttpResponse hr; 86 87 /** 88 * Details returned depending on the @e http_status. 89 */ 90 union 91 { 92 93 /** 94 * Details if status was request was succesfull 95 */ 96 struct 97 { 98 99 /** 100 * Config data returned by accounts/$USERNAME 101 */ 102 struct TALER_BANK_AccountInformation acc; 103 104 } ok; 105 106 } details; 107 108 }; 109 110 111 /** 112 * Function called with information about the bank. 113 * 114 * @param cls closure 115 * @param vr response data 116 */ 117 typedef void 118 (*TALER_BANK_AccountsCallback) ( 119 void *cls, 120 const struct TALER_BANK_AccountsResponse *vr); 121 122 123 /** 124 * Handle for the get config request. 125 */ 126 struct TALER_BANK_GetAccountsHandle; 127 128 129 /** 130 * Obtain bank account inforamtion 131 * @param ctx curl context 132 * @param url bank url 133 * @param username bank account name 134 * @param authorization authentication for account 135 * @param accounts_cb callback 136 * @param accounts_cb_cls callback context 137 * @return NULL on failure 138 */ 139 struct TALER_BANK_GetAccountsHandle * 140 TALER_BANK_get_accounts ( struct GNUNET_CURL_Context *ctx, 141 const char *url, 142 const char *username, 143 const struct DIGITIZER_BankAuthenticationData *authorization, 144 TALER_BANK_AccountsCallback accounts_cb, 145 void *accounts_cb_cls); 146 147 148 /** 149 * Cancel accounts request. Frees if neccessary 150 * @param account handle 151 */ 152 void TALER_BANK_get_accounts_cancel ( struct TALER_BANK_GetAccountsHandle *account); 153 154 #endif