merchant

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

get-management-instances-INSTANCE.h (6280B)


      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-management-instances-INSTANCE.h
     19  * @brief C interface for GET /management/instances/$INSTANCE of the merchant backend
     20  * @author Christian Grothoff
     21  */
     22 #ifndef _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_INSTANCE_H
     23 #define _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_INSTANCE_H
     24 
     25 #include <taler/taler-merchant/common.h>
     26 
     27 
     28 /**
     29  * Handle for a GET /management/instances/$INSTANCE request.
     30  */
     31 struct TALER_MERCHANT_GetManagementInstanceHandle;
     32 
     33 
     34 /**
     35  * Account details for a merchant wire account
     36  * as returned by GET /management/instances/$INSTANCE.
     37  */
     38 struct TALER_MERCHANT_ManagementAccountEntry
     39 {
     40 
     41   /**
     42    * Full payto URI of the account.
     43    */
     44   struct TALER_FullPayto payto_uri;
     45 
     46   /**
     47    * URL of the credit facade (optional, may be NULL).
     48    */
     49   const char *credit_facade_url;
     50 
     51   /**
     52    * Hash of the wire details.
     53    */
     54   struct TALER_MerchantWireHashP h_wire;
     55 
     56   /**
     57    * Salt used to compute @e h_wire.
     58    */
     59   struct TALER_WireSaltP salt;
     60 
     61   /**
     62    * True if the account is active.
     63    */
     64   bool active;
     65 
     66 };
     67 
     68 
     69 /**
     70  * Detailed information about a merchant instance.
     71  */
     72 struct TALER_MERCHANT_GetManagementInstanceDetails
     73 {
     74 
     75   /**
     76    * Human-readable name of the instance.
     77    */
     78   const char *name;
     79 
     80   /**
     81    * Public key of the merchant instance.
     82    */
     83   struct TALER_MerchantPublicKeyP merchant_pub;
     84 
     85   /**
     86    * Whether to use the STEFAN curve for fee calculations.
     87    */
     88   bool use_stefan;
     89 
     90   /**
     91    * Default wire transfer delay.
     92    */
     93   struct GNUNET_TIME_Relative default_wire_transfer_delay;
     94 
     95   /**
     96    * Default payment deadline.
     97    */
     98   struct GNUNET_TIME_Relative default_pay_delay;
     99 
    100   /**
    101    * Default refund deadline.
    102    */
    103   struct GNUNET_TIME_Relative default_refund_delay;
    104 
    105   /**
    106    * Default wire transfer rounding interval.
    107    */
    108   enum GNUNET_TIME_RounderInterval default_wire_transfer_rounding_interval;
    109 
    110   /**
    111    * Merchant address (JSON).
    112    */
    113   const json_t *address;
    114 
    115   /**
    116    * Merchant jurisdiction (JSON).
    117    */
    118   const json_t *jurisdiction;
    119 
    120   /**
    121    * Email address of the merchant (optional, may be NULL).
    122    */
    123   const char *email;
    124 
    125   /**
    126    * Whether the email address has been validated.
    127    * Only meaningful if @e email is not NULL.
    128    */
    129   bool email_validated;
    130 
    131   /**
    132    * Phone number of the merchant (optional, may be NULL).
    133    */
    134   const char *phone_number;
    135 
    136   /**
    137    * Whether the phone number has been validated.
    138    * Only meaningful if @e phone_number is not NULL.
    139    */
    140   bool phone_validated;
    141 
    142   /**
    143    * Website URL of the merchant (optional, may be NULL).
    144    */
    145   const char *website;
    146 
    147   /**
    148    * Logo of the merchant (optional, may be NULL).
    149    */
    150   const char *logo;
    151 
    152 };
    153 
    154 
    155 /**
    156  * Response details for a GET /management/instances/$INSTANCE request.
    157  */
    158 struct TALER_MERCHANT_GetManagementInstanceResponse
    159 {
    160 
    161   /**
    162    * HTTP response details.
    163    */
    164   struct TALER_MERCHANT_HttpResponse hr;
    165 
    166   /**
    167    * Details depending on the HTTP status code.
    168    */
    169   union
    170   {
    171 
    172     /**
    173      * Details on #MHD_HTTP_OK.
    174      */
    175     struct
    176     {
    177 
    178       /**
    179        * Detailed information about the instance.
    180        */
    181       struct TALER_MERCHANT_GetManagementInstanceDetails details;
    182 
    183       /**
    184        * Number of accounts in @a accounts.
    185        */
    186       unsigned int accounts_length;
    187 
    188       /**
    189        * Array of account entries.
    190        */
    191       const struct TALER_MERCHANT_ManagementAccountEntry *accounts;
    192 
    193     } ok;
    194 
    195   } details;
    196 
    197 };
    198 
    199 
    200 /**
    201  * Set up GET /management/instances/$INSTANCE operation.
    202  * Note that you must explicitly start the operation after
    203  * possibly setting options.
    204  *
    205  * @param ctx the context
    206  * @param url base URL of the merchant backend
    207  * @param instance_id identifier of the instance to retrieve,
    208  *        NULL for admin instance
    209  * @return handle to operation
    210  */
    211 struct TALER_MERCHANT_GetManagementInstanceHandle *
    212 TALER_MERCHANT_get_management_instance_create (
    213   struct GNUNET_CURL_Context *ctx,
    214   const char *url,
    215   const char *instance_id);
    216 
    217 
    218 #ifndef TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE
    219 /**
    220  * Type of the closure used by
    221  * the #TALER_MERCHANT_GetManagementInstanceCallback.
    222  */
    223 #define TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE void
    224 #endif /* TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE */
    225 
    226 /**
    227  * Callback for a GET /management/instances/$INSTANCE request.
    228  *
    229  * @param cls closure
    230  * @param igr response details
    231  */
    232 typedef void
    233 (*TALER_MERCHANT_GetManagementInstanceCallback)(
    234   TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE *cls,
    235   const struct TALER_MERCHANT_GetManagementInstanceResponse *igr);
    236 
    237 
    238 /**
    239  * Start GET /management/instances/$INSTANCE operation.
    240  *
    241  * @param[in,out] gmi operation to start
    242  * @param cb function to call with the merchant's result
    243  * @param cb_cls closure for @a cb
    244  * @return status code, #TALER_EC_NONE on success
    245  */
    246 enum TALER_ErrorCode
    247 TALER_MERCHANT_get_management_instance_start (
    248   struct TALER_MERCHANT_GetManagementInstanceHandle *gmi,
    249   TALER_MERCHANT_GetManagementInstanceCallback cb,
    250   TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE *cb_cls);
    251 
    252 
    253 /**
    254  * Cancel GET /management/instances/$INSTANCE operation.  This function
    255  * must not be called by clients after the
    256  * TALER_MERCHANT_GetManagementInstanceCallback has been invoked
    257  * (as in those cases it'll be called internally by the
    258  * implementation already).
    259  *
    260  * @param[in] gmi operation to cancel
    261  */
    262 void
    263 TALER_MERCHANT_get_management_instance_cancel (
    264   struct TALER_MERCHANT_GetManagementInstanceHandle *gmi);
    265 
    266 
    267 #endif /* _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_INSTANCE_H */