merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

get-private-templates-TEMPLATE_ID.h (3026B)


      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 Lesser General Public License as published by the Free Software
      7   Foundation; either version 2.1, 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 Lesser General Public License for more details.
     12 
     13   You should have received a copy of the GNU Lesser General Public License along with
     14   TALER; see the file COPYING.LGPL.  If not, see
     15   <http://www.gnu.org/licenses/>
     16 */
     17 /**
     18  * @file include/taler/taler-merchant/get-private-templates-TEMPLATE_ID.h
     19  * @brief C interface for GET /private/templates/$TEMPLATE_ID of the merchant backend
     20  * @author Christian Grothoff
     21  */
     22 #ifndef _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_TEMPLATE_ID_H
     23 #define _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_TEMPLATE_ID_H
     24 
     25 #include <taler/taler-merchant/common.h>
     26 
     27 
     28 /**
     29  * Handle for a GET /private/templates/$TEMPLATE_ID request.
     30  */
     31 struct TALER_MERCHANT_TemplateGetHandle;
     32 
     33 
     34 /**
     35  * Response details for a GET /private/templates/$TEMPLATE_ID request.
     36  */
     37 struct TALER_MERCHANT_TemplateGetResponse
     38 {
     39 
     40   /**
     41    * HTTP response details.
     42    */
     43   struct TALER_MERCHANT_HttpResponse hr;
     44 
     45   /**
     46    * Details depending on the HTTP status code.
     47    */
     48   union
     49   {
     50 
     51     /**
     52      * Details on #MHD_HTTP_OK.
     53      */
     54     struct
     55     {
     56 
     57       /**
     58        * Human-readable description of the template.
     59        */
     60       const char *template_description;
     61 
     62       /**
     63        * OTP device ID associated with this template, or NULL.
     64        */
     65       const char *otp_id;
     66 
     67       /**
     68        * Template contract (JSON).
     69        */
     70       const json_t *template_contract;
     71 
     72     } ok;
     73 
     74   } details;
     75 
     76 };
     77 
     78 
     79 /**
     80  * Callback for a GET /private/templates/$TEMPLATE_ID request.
     81  *
     82  * @param cls closure
     83  * @param tgr response details
     84  */
     85 typedef void
     86 (*TALER_MERCHANT_TemplateGetCallback)(
     87   void *cls,
     88   const struct TALER_MERCHANT_TemplateGetResponse *tgr);
     89 
     90 
     91 /**
     92  * Issue a GET /private/templates/$TEMPLATE_ID request.
     93  *
     94  * @param ctx CURL context to use
     95  * @param backend_url base URL of the merchant backend
     96  * @param template_id identifier of the template to retrieve
     97  * @param cb callback to invoke with the result
     98  * @param cb_cls closure for @a cb
     99  * @return handle for the request, NULL on hard error
    100  */
    101 struct TALER_MERCHANT_TemplateGetHandle *
    102 TALER_MERCHANT_template_get (struct GNUNET_CURL_Context *ctx,
    103                              const char *backend_url,
    104                              const char *template_id,
    105                              TALER_MERCHANT_TemplateGetCallback cb,
    106                              void *cb_cls);
    107 
    108 
    109 /**
    110  * Cancel a GET /private/templates/$TEMPLATE_ID request.
    111  *
    112  * @param[in] tgh handle to cancel
    113  */
    114 void
    115 TALER_MERCHANT_template_get_cancel (
    116   struct TALER_MERCHANT_TemplateGetHandle *tgh);
    117 
    118 
    119 #endif