commit 8156c65e18c08f98ac81c1e4bc86f643efd2e411
parent 3defe9e41069acfbc24a96473d827d82f9e71a04
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 8 Jun 2026 21:17:45 +0200
update convenience function to specifically accept the ToS
Diffstat:
2 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/src/include/taler/exchange/post-kyc-upload-ID.h b/src/include/taler/exchange/post-kyc-upload-ID.h
@@ -50,6 +50,31 @@ TALER_EXCHANGE_post_kyc_upload_create (
/**
+ * Set up POST /kyc-upload/$ID operation to accept the exchange's
+ * terms of service. This is a convenience wrapper around
+ * #TALER_EXCHANGE_post_kyc_upload_create() that submits the
+ * @c "accept-tos" KYC form affirming acceptance of the given
+ * version of the terms of service.
+ * Note that you must explicitly start the operation after setup.
+ *
+ * @param ctx CURL context
+ * @param url exchange base URL
+ * @param id identifier for the KYC process the acceptance is for
+ * @param tos_etag ETag identifying the version of the terms of
+ * service being accepted; this is the value returned in the
+ * @e tos_required field of a GET /kyc-check/$H_NORMALIZED_PAYTO
+ * (or /kyc-info) response
+ * @return handle to operation, NULL on error
+ */
+struct TALER_EXCHANGE_PostKycUploadHandle *
+TALER_EXCHANGE_post_kyc_upload_accept_tos_create (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ const char *id,
+ const char *tos_etag);
+
+
+/**
* KYC upload response details.
*/
struct TALER_EXCHANGE_PostKycUploadResponse
diff --git a/src/lib/exchange_api_post-kyc-upload-ID.c b/src/lib/exchange_api_post-kyc-upload-ID.c
@@ -169,6 +169,35 @@ TALER_EXCHANGE_post_kyc_upload_create (
}
+struct TALER_EXCHANGE_PostKycUploadHandle *
+TALER_EXCHANGE_post_kyc_upload_accept_tos_create (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ const char *id,
+ const char *tos_etag)
+{
+ struct TALER_EXCHANGE_PostKycUploadHandle *pksh;
+ json_t *attributes;
+
+ attributes = GNUNET_JSON_PACK (
+ /* form ID of the terms-of-service acceptance form */
+ GNUNET_JSON_pack_string ("FORM_ID",
+ "accept-tos"),
+ /* version (ETag) of the terms of service being accepted */
+ GNUNET_JSON_pack_string ("ACCEPTED_TERMS_OF_SERVICE",
+ tos_etag),
+ /* affirm that the terms of service were read/downloaded */
+ GNUNET_JSON_pack_bool ("DOWNLOADED_TERMS_OF_SERVICE",
+ true));
+ pksh = TALER_EXCHANGE_post_kyc_upload_create (ctx,
+ url,
+ id,
+ attributes);
+ json_decref (attributes);
+ return pksh;
+}
+
+
enum TALER_ErrorCode
TALER_EXCHANGE_post_kyc_upload_start (
struct TALER_EXCHANGE_PostKycUploadHandle *pksh,