bank_api_post_accounts_withdrawals_confirm.h (4135B)
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_post_accounts_withdrawals_confirm.h 21 * @brief implements the Taler Bank API "POST /accounts/$USERNAME/withdrawals/$WITHDRAWAL_ID/confirm" handler 22 * @author Reto Tellenbach 23 */ 24 #ifndef BANK_API_POST_ACCOUNTS_WITHDRAWALS_CONFIRM_H 25 #define BANK_API_POST_ACCOUNTS_WITHDRAWALS_CONFIRM_H 26 27 #include <taler/taler_curl_lib.h> 28 #include "bank_api_curl_defaults.h" 29 #include "api_common.h" 30 #include "taler/taler_bank_service.h" 31 32 33 /** 34 * @brief withdrawal operation information 35 * provided for request 36 */ 37 struct TALER_BANK_AccountWithdrawalConfirmRequest 38 { 39 /** 40 * Amount to withdraw. 41 * Has to be set if not set at withrawal creation 42 */ 43 struct TALER_Amount amount; 44 }; 45 46 /** 47 * challenge response not jet implemented 48 */ 49 struct TALER_BANK_ChallengeResponse 50 { 51 /** 52 * temporal json object for parsing 53 */ 54 json_t *blc; 55 }; 56 57 /** 58 * Response details for a accounts/$USERNAME/withdrawals request 59 */ 60 struct TALER_BANK_WithdrawalConfirmResponse 61 { 62 63 /** 64 * HTTP response 65 */ 66 struct TALER_BANK_HttpResponse hr; 67 68 /** 69 * Details returned depending on the @e http_status. 70 */ 71 union 72 { 73 74 /** 75 * Details if status was request was succesfull 76 */ 77 struct 78 { 79 80 /** 81 * KYC challenge 82 */ 83 struct TALER_BANK_ChallengeResponse challenge; 84 85 } ok; 86 87 } details; 88 89 }; 90 91 92 /** 93 * Callback after confirming the withdrawal 94 * 95 * @param cls closure 96 * @param vr response data 97 */ 98 typedef void 99 (*TALER_BANK_WithdrawalConfirmCallback) ( 100 void *cls, 101 const struct TALER_BANK_WithdrawalConfirmResponse *vr); 102 103 104 /** 105 * Handle for the post confirm withdrawal request. 106 */ 107 struct TALER_BANK_PostWithdrawalConfirmHandle; 108 109 110 /** 111 * create handle for post TALER_BANK_post_accounts_withdrawal_confirm_confirm() 112 * @param ctx curl context 113 * @param url bank url 114 * @param username bank account name 115 * @param authorization authentication for account 116 * @param accounts_cb callback 117 * @param accounts_cb_cls callback context 118 * @return NULL on failure 119 */ 120 struct TALER_BANK_PostWithdrawalConfirmHandle * 121 TALER_BANK_post_accounts_withdrawal_confirm_confirm_create ( struct GNUNET_CURL_Context *ctx, 122 const char *base_url, 123 const char *username, 124 const struct DIGITIZER_BankAuthenticationData *authorization); 125 126 127 /** 128 * Http request POST /accounts/withdrawal/confirm 129 * @param handle handle, is created with TALER_BANK_post_accounts_withdrawal_confirm_confirm_create() 130 * @param req_ctx request body data 131 * @param wo_confirm_cb callback 132 * @param wo_confirm_cb_cls callback context 133 * @return GNUNET_NO on failure 134 */ 135 enum GNUNET_GenericReturnValue 136 TALER_BANK_post_withdrawal_confirm ( struct TALER_BANK_PostWithdrawalConfirmHandle *handle, 137 const struct TALER_BANK_AccountWithdrawalConfirmRequest*req_ctx, 138 TALER_BANK_WithdrawalConfirmCallback pwc_cb, 139 void *pwc_cb_cls); 140 141 142 /** 143 * Cancel accounts confirm withdrawal request. Frees if neccessary 144 * @param account handle 145 */ 146 void 147 TALER_BANK_post_withdrawal_confirm_cancel ( struct TALER_BANK_PostWithdrawalConfirmHandle *pwch); 148 149 #endif