post-kyc-upload-ID.h (4540B)
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/exchange/post-kyc-upload-ID.h 18 * @brief C interface for POST /kyc-upload/$ID 19 * @author Christian Grothoff 20 */ 21 #ifndef _TALER_EXCHANGE__POST_KYC_UPLOAD_ID_H 22 #define _TALER_EXCHANGE__POST_KYC_UPLOAD_ID_H 23 24 #include <taler/exchange/common.h> 25 26 /** 27 * Handle for an operation to POST /kyc-upload/$ID. 28 */ 29 struct TALER_EXCHANGE_PostKycUploadHandle; 30 31 32 /** 33 * Set up POST /kyc-upload/$ID operation. 34 * Note that you must explicitly start the operation after setup. 35 * 36 * @param ctx CURL context 37 * @param url exchange base URL 38 * @param id identifier for the KYC process the upload is for 39 * @param attributes the client-provided evidence to upload; a 40 * `CustomerKycAttributes` object that depends on the form 41 * being submitted, but MUST include the form ID 42 * @return handle to operation, NULL on error 43 */ 44 struct TALER_EXCHANGE_PostKycUploadHandle * 45 TALER_EXCHANGE_post_kyc_upload_create ( 46 struct GNUNET_CURL_Context *ctx, 47 const char *url, 48 const char *id, 49 const json_t *attributes); 50 51 52 /** 53 * Set up POST /kyc-upload/$ID operation to accept the exchange's 54 * terms of service. This is a convenience wrapper around 55 * #TALER_EXCHANGE_post_kyc_upload_create() that submits the 56 * @c "accept-tos" KYC form affirming acceptance of the given 57 * version of the terms of service. 58 * Note that you must explicitly start the operation after setup. 59 * 60 * @param ctx CURL context 61 * @param url exchange base URL 62 * @param id identifier for the KYC process the acceptance is for 63 * @param tos_etag ETag identifying the version of the terms of 64 * service being accepted; this is the value returned in the 65 * @e tos_required field of a GET /kyc-check/$H_NORMALIZED_PAYTO 66 * (or /kyc-info) response 67 * @return handle to operation, NULL on error 68 */ 69 struct TALER_EXCHANGE_PostKycUploadHandle * 70 TALER_EXCHANGE_post_kyc_upload_accept_tos_create ( 71 struct GNUNET_CURL_Context *ctx, 72 const char *url, 73 const char *id, 74 const char *tos_etag); 75 76 77 /** 78 * KYC upload response details. 79 */ 80 struct TALER_EXCHANGE_PostKycUploadResponse 81 { 82 /** 83 * HTTP response data 84 */ 85 struct TALER_EXCHANGE_HttpResponse hr; 86 87 /** 88 * Details depending on @e hr.http_status. 89 */ 90 union 91 { 92 /** 93 * Empty, @e hr.http_status is #MHD_HTTP_NO_CONTENT. 94 */ 95 char empty[0]; 96 97 } details; 98 99 }; 100 101 102 #ifndef TALER_EXCHANGE_POST_KYC_UPLOAD_RESULT_CLOSURE 103 /** 104 * Type of the closure used by 105 * the #TALER_EXCHANGE_PostKycUploadCallback. 106 */ 107 #define TALER_EXCHANGE_POST_KYC_UPLOAD_RESULT_CLOSURE void 108 #endif /* TALER_EXCHANGE_POST_KYC_UPLOAD_RESULT_CLOSURE */ 109 110 /** 111 * Type of the function that receives the result of a 112 * POST /kyc-upload/$ID request. 113 * 114 * @param cls closure 115 * @param result result returned by the HTTP server 116 */ 117 typedef void 118 (*TALER_EXCHANGE_PostKycUploadCallback)( 119 TALER_EXCHANGE_POST_KYC_UPLOAD_RESULT_CLOSURE *cls, 120 const struct TALER_EXCHANGE_PostKycUploadResponse *result); 121 122 123 /** 124 * Start POST /kyc-upload/$ID operation. 125 * 126 * @param[in,out] pksh operation to start 127 * @param cb function to call with the exchange's result 128 * @param cb_cls closure for @a cb 129 * @return status code, #TALER_EC_NONE on success 130 */ 131 enum TALER_ErrorCode 132 TALER_EXCHANGE_post_kyc_upload_start ( 133 struct TALER_EXCHANGE_PostKycUploadHandle *pksh, 134 TALER_EXCHANGE_PostKycUploadCallback cb, 135 TALER_EXCHANGE_POST_KYC_UPLOAD_RESULT_CLOSURE *cb_cls); 136 137 138 /** 139 * Cancel POST /kyc-upload/$ID operation. This function must not be called by 140 * clients after the TALER_EXCHANGE_PostKycUploadCallback has been invoked (as 141 * in those cases it'll be called internally by the implementation already). 142 * 143 * @param[in] pksh operation to cancel 144 */ 145 void 146 TALER_EXCHANGE_post_kyc_upload_cancel ( 147 struct TALER_EXCHANGE_PostKycUploadHandle *pksh); 148 149 150 #endif /* _TALER_EXCHANGE__POST_KYC_UPLOAD_ID_H */