post-management-drain.h (3854B)
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 Affero 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 Affero General Public License for more details. 12 13 You should have received a copy of the GNU Affero General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file include/taler/taler-exchange/post-management-drain.h 18 * @brief C interface for POST /management/drain 19 * @author Christian Grothoff 20 */ 21 #ifndef _TALER_EXCHANGE__POST_MANAGEMENT_DRAIN_H 22 #define _TALER_EXCHANGE__POST_MANAGEMENT_DRAIN_H 23 24 #include <taler/taler-exchange/common.h> 25 26 /** 27 * Handle for an operation to POST /management/drain. 28 */ 29 struct TALER_EXCHANGE_PostManagementDrainHandle; 30 31 32 /** 33 * Set up POST /management/drain operation. 34 * Note that you must explicitly start the operation after setup. 35 * 36 * @param ctx the context 37 * @param url HTTP base URL for the exchange 38 * @param wtid wire transfer identifier to use 39 * @param amount total to transfer 40 * @param date when was the request created 41 * @param account_section configuration section identifying account to debit 42 * @param payto_uri RFC 8905 URI of the account to credit 43 * @param master_sig signature affirming the operation 44 * @return handle to operation, NULL on error 45 */ 46 struct TALER_EXCHANGE_PostManagementDrainHandle * 47 TALER_EXCHANGE_post_management_drain_create ( 48 struct GNUNET_CURL_Context *ctx, 49 const char *url, 50 const struct TALER_WireTransferIdentifierRawP *wtid, 51 const struct TALER_Amount *amount, 52 struct GNUNET_TIME_Timestamp date, 53 const char *account_section, 54 const struct TALER_FullPayto payto_uri, 55 const struct TALER_MasterSignatureP *master_sig); 56 57 58 /** 59 * Response from a POST /management/drain request. 60 */ 61 struct TALER_EXCHANGE_PostManagementDrainResponse 62 { 63 /** 64 * HTTP response data 65 */ 66 struct TALER_EXCHANGE_HttpResponse hr; 67 }; 68 69 70 #ifndef TALER_EXCHANGE_POST_MANAGEMENT_DRAIN_RESULT_CLOSURE 71 /** 72 * Type of the closure used by 73 * the #TALER_EXCHANGE_PostManagementDrainCallback. 74 */ 75 #define TALER_EXCHANGE_POST_MANAGEMENT_DRAIN_RESULT_CLOSURE void 76 #endif /* TALER_EXCHANGE_POST_MANAGEMENT_DRAIN_RESULT_CLOSURE */ 77 78 /** 79 * Type of the function that receives the result of a 80 * POST /management/drain request. 81 * 82 * @param cls closure 83 * @param result result returned by the HTTP server 84 */ 85 typedef void 86 (*TALER_EXCHANGE_PostManagementDrainCallback)( 87 TALER_EXCHANGE_POST_MANAGEMENT_DRAIN_RESULT_CLOSURE *cls, 88 const struct TALER_EXCHANGE_PostManagementDrainResponse *result); 89 90 91 /** 92 * Start POST /management/drain operation. 93 * 94 * @param[in,out] pmdh operation to start 95 * @param cb function to call with the exchange's result 96 * @param cb_cls closure for @a cb 97 * @return status code, #TALER_EC_NONE on success 98 */ 99 enum TALER_ErrorCode 100 TALER_EXCHANGE_post_management_drain_start ( 101 struct TALER_EXCHANGE_PostManagementDrainHandle *pmdh, 102 TALER_EXCHANGE_PostManagementDrainCallback cb, 103 TALER_EXCHANGE_POST_MANAGEMENT_DRAIN_RESULT_CLOSURE *cb_cls); 104 105 106 /** 107 * Cancel POST /management/drain operation. This function must not be 108 * called by clients after the TALER_EXCHANGE_PostManagementDrainCallback 109 * has been invoked (as in those cases it'll be called internally by the 110 * implementation already). 111 * 112 * @param[in] pmdh operation to cancel 113 */ 114 void 115 TALER_EXCHANGE_post_management_drain_cancel ( 116 struct TALER_EXCHANGE_PostManagementDrainHandle *pmdh); 117 118 119 120 #endif /* _TALER_EXCHANGE__POST_MANAGEMENT_DRAIN_H */