merchant

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

get-private-accounts.h (3970B)


      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 src/include/taler/merchant/get-private-accounts.h
     19  * @brief C interface for the GET /private/accounts endpoint
     20  * @author Christian Grothoff
     21  */
     22 #ifndef _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H
     23 #define _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H
     24 
     25 #include <taler/merchant/common.h>
     26 
     27 
     28 /**
     29  * Handle for a GET /private/accounts request.
     30  */
     31 struct TALER_MERCHANT_GetPrivateAccountsHandle;
     32 
     33 
     34 /**
     35  * Account details for a merchant wire account.
     36  */
     37 struct TALER_MERCHANT_GetPrivateAccountsAccountEntry
     38 {
     39 
     40   /**
     41    * Hash of the wire details.
     42    */
     43   struct TALER_MerchantWireHashP h_wire;
     44 
     45   /**
     46    * Full payto URI of the account.
     47    */
     48   struct TALER_FullPayto payto_uri;
     49 
     50   /**
     51    * True if the account is active.
     52    */
     53   bool active;
     54 
     55 };
     56 
     57 
     58 /**
     59  * Response details for a GET /private/accounts request.
     60  */
     61 struct TALER_MERCHANT_GetPrivateAccountsResponse
     62 {
     63 
     64   /**
     65    * HTTP response details.
     66    */
     67   struct TALER_MERCHANT_HttpResponse hr;
     68 
     69   /**
     70    * Details depending on the HTTP status code.
     71    */
     72   union
     73   {
     74 
     75     /**
     76      * Details on #MHD_HTTP_OK.
     77      */
     78     struct
     79     {
     80 
     81       /**
     82        * Number of accounts in @a accounts.
     83        */
     84       unsigned int accounts_length;
     85 
     86       /**
     87        * Array of account entries.
     88        */
     89       const struct TALER_MERCHANT_GetPrivateAccountsAccountEntry *accounts;
     90 
     91     } ok;
     92 
     93   } details;
     94 
     95 };
     96 
     97 
     98 /**
     99  * Set up GET /private/accounts operation.
    100  * Note that you must explicitly start the operation after
    101  * possibly setting options.
    102  *
    103  * @param ctx the context
    104  * @param url base URL of the merchant backend
    105  * @return handle to operation
    106  */
    107 struct TALER_MERCHANT_GetPrivateAccountsHandle *
    108 TALER_MERCHANT_get_private_accounts_create (
    109   struct GNUNET_CURL_Context *ctx,
    110   const char *url);
    111 
    112 
    113 #ifndef TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE
    114 /**
    115  * Type of the closure used by
    116  * the #TALER_MERCHANT_GetPrivateAccountsCallback.
    117  */
    118 #define TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE void
    119 #endif /* TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE */
    120 
    121 /**
    122  * Callback for a GET /private/accounts request.
    123  *
    124  * @param cls closure
    125  * @param agr response details
    126  */
    127 typedef void
    128 (*TALER_MERCHANT_GetPrivateAccountsCallback)(
    129   TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE *cls,
    130   const struct TALER_MERCHANT_GetPrivateAccountsResponse *agr);
    131 
    132 
    133 /**
    134  * Start GET /private/accounts operation.
    135  *
    136  * @param[in,out] gpah operation to start
    137  * @param cb function to call with the merchant's result
    138  * @param cb_cls closure for @a cb
    139  * @return status code, #TALER_EC_NONE on success
    140  */
    141 enum TALER_ErrorCode
    142 TALER_MERCHANT_get_private_accounts_start (
    143   struct TALER_MERCHANT_GetPrivateAccountsHandle *gpah,
    144   TALER_MERCHANT_GetPrivateAccountsCallback cb,
    145   TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE *cb_cls);
    146 
    147 
    148 /**
    149  * Cancel GET /private/accounts operation.  This function must not be
    150  * called by clients after the TALER_MERCHANT_GetPrivateAccountsCallback
    151  * has been invoked (as in those cases it'll be called internally by the
    152  * implementation already).
    153  *
    154  * @param[in] gpah operation to cancel
    155  */
    156 void
    157 TALER_MERCHANT_get_private_accounts_cancel (
    158   struct TALER_MERCHANT_GetPrivateAccountsHandle *gpah);
    159 
    160 
    161 #endif /* _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H */