From 165c5337b1fc1df42521ab1cba520b7ddede6fdd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 21 Feb 2023 17:43:11 +0100 Subject: add algorithm identifier to client API --- src/include/taler_merchant_service.h | 72 +++++++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 13 deletions(-) (limited to 'src/include/taler_merchant_service.h') diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 8237b47a..b748309e 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -4177,21 +4177,63 @@ struct TALER_MERCHANT_TemplateGetHandle; /** - * Function called with the result of the GET /templates operation. + * Details in a response to a GET /templates request. + */ +struct TALER_MERCHANT_TemplateGetResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Response details depending on the HTTP status. + */ + union + { + /** + * Information returned if the status was #MHD_HTTP_OK. + */ + struct + { + + /** + * description of the template + */ + const char *template_description; + + /** + * Shared key with the POS + */ + const char *pos_key; + + /** + * Template for the contract. + */ + const json_t *template_contract; + + /** + * Algorithm used to generate confirmations for the merchant. + */ + enum TALER_MerchantConfirmationAlgorithm mca; + + } success; + + } details; + +}; + + +/** + * Function called with the result of the GET /template/$ID operation. * * @param cls closure - * @param hr HTTP response details - * @param template_description description of the template - * @param image base64-encoded product image - * @param template_contract is the contract of the company + * @param tgr HTTP response details */ typedef void (*TALER_MERCHANT_TemplateGetCallback)( void *cls, - const struct TALER_MERCHANT_HttpResponse *hr, - const char *template_description, - const char *image, - const json_t *template_contract); + const struct TALER_MERCHANT_TemplateGetResponse *tgr); /** @@ -4249,7 +4291,8 @@ typedef void * @param backend_url HTTP base URL for the backend * @param template_id identifier to use for the template * @param template_description description of the template - * @param image base64-encoded product image + * @param pos_key shared key with the POS + * @param mca algorithm used to generate confirmations * @param template_contract is the contract of the company * @param cb function to call with the backend's result * @param cb_cls closure for @a cb @@ -4261,7 +4304,8 @@ TALER_MERCHANT_templates_post ( const char *backend_url, const char *template_id, const char *template_description, - const char *image, + const char *pos_key, + enum TALER_MerchantConfirmationAlgorithm mca, const json_t *template_contract, TALER_MERCHANT_TemplatesPostCallback cb, void *cb_cls); @@ -4304,7 +4348,8 @@ typedef void * or the transaction will fail with a #MHD_HTTP_NOT_FOUND * HTTP status code * @param template_description description of the template - * @param image base64-encoded product image + * @param pos shared key with the POS + * @param mca algorithm used to generate confirmations * @param template_contract is the contract of the company * @param cb function to call with the backend's result * @param cb_cls closure for @a cb @@ -4316,7 +4361,8 @@ TALER_MERCHANT_template_patch ( const char *backend_url, const char *template_id, const char *template_description, - const char *image, + const char *pos_key, + enum TALER_MerchantConfirmationAlgorithm mca, json_t *template_contract, TALER_MERCHANT_TemplatePatchCallback cb, void *cb_cls); -- cgit v1.2.3