get-private-accounts-H_WIRE.h (4468B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2014-2026 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU Lesser General Public License as published by the Free Software 7 Foundation; either version 2.1, 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 Lesser General Public License for more details. 12 13 You should have received a copy of the GNU Lesser General Public License along with 14 TALER; see the file COPYING.LGPL. If not, see 15 <http://www.gnu.org/licenses/> 16 */ 17 /** 18 * @file src/include/taler/merchant/get-private-accounts-H_WIRE.h 19 * @brief C interface for GET /private/accounts/$H_WIRE of the merchant backend 20 * @author Christian Grothoff 21 */ 22 #ifndef _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H_WIRE_H 23 #define _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H_WIRE_H 24 25 #include <taler/merchant/common.h> 26 27 28 /** 29 * Handle for a GET /private/accounts/$H_WIRE request. 30 */ 31 struct TALER_MERCHANT_GetPrivateAccountHandle; 32 33 34 /** 35 * Account details for a merchant wire account. 36 */ 37 struct TALER_MERCHANT_GetPrivateAccountDetails 38 { 39 40 /** 41 * Hash of the wire details. 42 */ 43 struct TALER_MerchantWireHashP h_wire; 44 45 /** 46 * Salt used in the wire hash computation. 47 */ 48 struct TALER_WireSaltP salt; 49 50 /** 51 * Full payto URI of the account. 52 */ 53 struct TALER_FullPayto payto_uri; 54 55 /** 56 * URL of the credit facade, or NULL if none. 57 */ 58 const char *credit_facade_url; 59 60 /** 61 * Extra wire subject metadata, or NULL if not provided. 62 * Available since protocol v27. 63 */ 64 const json_t *extra_wire_subject_metadata; 65 66 /** 67 * True if the account is currently active. 68 */ 69 bool active; 70 71 }; 72 73 74 /** 75 * Response details for a GET /private/accounts/$H_WIRE request. 76 */ 77 struct TALER_MERCHANT_GetPrivateAccountResponse 78 { 79 80 /** 81 * HTTP response details. 82 */ 83 struct TALER_MERCHANT_HttpResponse hr; 84 85 /** 86 * Details depending on the HTTP status code. 87 */ 88 union 89 { 90 91 /** 92 * Details on #MHD_HTTP_OK. 93 */ 94 struct 95 { 96 97 /** 98 * Detailed account information. 99 */ 100 struct TALER_MERCHANT_GetPrivateAccountDetails ad; 101 102 } ok; 103 104 } details; 105 106 }; 107 108 109 /** 110 * Set up GET /private/accounts/$H_WIRE operation. 111 * Note that you must explicitly start the operation after 112 * possibly setting options. 113 * 114 * @param ctx the context 115 * @param url base URL of the merchant backend 116 * @param instance_id identifier of the merchant instance 117 * @param h_wire hash of the wire details identifying the account 118 * @return handle to operation 119 */ 120 struct TALER_MERCHANT_GetPrivateAccountHandle * 121 TALER_MERCHANT_get_private_account_create ( 122 struct GNUNET_CURL_Context *ctx, 123 const char *url, 124 const char *instance_id, 125 const struct TALER_MerchantWireHashP *h_wire); 126 127 128 #ifndef TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE 129 /** 130 * Type of the closure used by 131 * the #TALER_MERCHANT_GetPrivateAccountCallback. 132 */ 133 #define TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE void 134 #endif /* TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE */ 135 136 /** 137 * Callback for a GET /private/accounts/$H_WIRE request. 138 * 139 * @param cls closure 140 * @param agr response details 141 */ 142 typedef void 143 (*TALER_MERCHANT_GetPrivateAccountCallback)( 144 TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE *cls, 145 const struct TALER_MERCHANT_GetPrivateAccountResponse *agr); 146 147 148 /** 149 * Start GET /private/accounts/$H_WIRE operation. 150 * 151 * @param[in,out] gpa operation to start 152 * @param cb function to call with the merchant's result 153 * @param cb_cls closure for @a cb 154 * @return status code, #TALER_EC_NONE on success 155 */ 156 enum TALER_ErrorCode 157 TALER_MERCHANT_get_private_account_start ( 158 struct TALER_MERCHANT_GetPrivateAccountHandle *gpa, 159 TALER_MERCHANT_GetPrivateAccountCallback cb, 160 TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE *cb_cls); 161 162 163 /** 164 * Cancel GET /private/accounts/$H_WIRE operation. This function 165 * must not be called by clients after the 166 * TALER_MERCHANT_GetPrivateAccountCallback has been invoked 167 * (as in those cases it'll be called internally by the 168 * implementation already). 169 * 170 * @param[in] gpa operation to cancel 171 */ 172 void 173 TALER_MERCHANT_get_private_account_cancel ( 174 struct TALER_MERCHANT_GetPrivateAccountHandle *gpa); 175 176 177 #endif /* _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H_WIRE_H */