merchant

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

delete-private-orders-ORDER_ID.h (6025B)


      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/delete-private-orders-ORDER_ID.h
     19  * @brief C interface for DELETE /private/orders/$ORDER_ID
     20  * @author Christian Grothoff
     21  */
     22 #ifndef _TALER_MERCHANT__DELETE_PRIVATE_ORDERS_ORDER_ID_H
     23 #define _TALER_MERCHANT__DELETE_PRIVATE_ORDERS_ORDER_ID_H
     24 
     25 #include <taler/merchant/common.h>
     26 
     27 
     28 /**
     29  * Handle for a DELETE /private/orders/$ORDER_ID operation.
     30  */
     31 struct TALER_MERCHANT_DeletePrivateOrderHandle;
     32 
     33 
     34 /**
     35  * Set up DELETE /private/orders/$ORDER_ID operation.
     36  * Note that you must explicitly start the operation after setup.
     37  *
     38  * @param ctx curl context
     39  * @param url merchant backend base URL
     40  * @param order_id identifier of the order to delete
     41  * @return handle to operation, NULL on error
     42  */
     43 struct TALER_MERCHANT_DeletePrivateOrderHandle *
     44 TALER_MERCHANT_delete_private_order_create (
     45   struct GNUNET_CURL_Context *ctx,
     46   const char *url,
     47   const char *order_id);
     48 
     49 
     50 /**
     51  * Options for DELETE /private/orders/$ORDER_ID.
     52  */
     53 enum TALER_MERCHANT_DeletePrivateOrderOption
     54 {
     55   /**
     56    * Sentinel value, end of options.
     57    */
     58   TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_END = 0,
     59 
     60   /**
     61    * If set, force deletion even if order has payments.
     62    * Value type: none (presence of option means force=true).
     63    */
     64   TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_FORCE
     65 };
     66 
     67 
     68 /**
     69  * Value for a DELETE /private/orders/$ORDER_ID option.
     70  */
     71 struct TALER_MERCHANT_DeletePrivateOrderOptionValue
     72 {
     73   /**
     74    * Which option is being set.
     75    */
     76   enum TALER_MERCHANT_DeletePrivateOrderOption option;
     77 };
     78 
     79 
     80 /**
     81  * Ends list of options.
     82  */
     83 #define TALER_MERCHANT_delete_private_order_set_option_end() \
     84         (struct TALER_MERCHANT_DeletePrivateOrderOptionValue) \
     85         { .option = TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_END }
     86 
     87 /**
     88  * Force deletion even if the order has been claimed.
     89  */
     90 #define TALER_MERCHANT_delete_private_order_set_option_force() \
     91         (struct TALER_MERCHANT_DeletePrivateOrderOptionValue) \
     92         { .option = TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_FORCE }
     93 
     94 
     95 /**
     96  * Set options for DELETE /private/orders/$ORDER_ID operation.
     97  *
     98  * @param[in,out] handle the handle to set options for
     99  * @param num_options length of the @a options array
    100  * @param options array of option values (terminated with _END)
    101  * @return #GNUNET_OK on success,
    102  *         #GNUNET_NO on failure,
    103  *         #GNUNET_SYSERR on internal error
    104  */
    105 enum GNUNET_GenericReturnValue
    106 TALER_MERCHANT_delete_private_order_set_options_ (
    107   struct TALER_MERCHANT_DeletePrivateOrderHandle *handle,
    108   unsigned int num_options,
    109   const struct TALER_MERCHANT_DeletePrivateOrderOptionValue options[]);
    110 
    111 
    112 /**
    113  * Maximum number of options for set_options macro.
    114  */
    115 #define TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTIONS_ARRAY_MAX_SIZE 4
    116 
    117 /**
    118  * Set options for DELETE /private/orders/$ORDER_ID operation.
    119  * Variadic macro wrapper around
    120  * #TALER_MERCHANT_delete_private_order_set_options_().
    121  *
    122  * @param handle the handle to set options for
    123  * @param ... option values (automatically terminated with _END)
    124  * @return #GNUNET_OK on success,
    125  *         #GNUNET_NO on failure,
    126  *         #GNUNET_SYSERR on internal error
    127  */
    128 #define TALER_MERCHANT_delete_private_order_set_options(handle, ...) \
    129         TALER_MERCHANT_delete_private_order_set_options_ ( \
    130           handle, \
    131           TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTIONS_ARRAY_MAX_SIZE, \
    132           ((const struct TALER_MERCHANT_DeletePrivateOrderOptionValue[]) \
    133            {__VA_ARGS__,                                                 \
    134             TALER_MERCHANT_delete_private_order_set_option_end () }      \
    135           ))
    136 
    137 /**
    138  * Response details for a DELETE /private/orders/$ORDER_ID request.
    139  */
    140 struct TALER_MERCHANT_DeletePrivateOrderResponse
    141 {
    142   /**
    143    * HTTP response details.
    144    */
    145   struct TALER_MERCHANT_HttpResponse hr;
    146 };
    147 
    148 
    149 #ifndef TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE
    150 /**
    151  * Type of the closure used by
    152  * the #TALER_MERCHANT_DeletePrivateOrderCallback.
    153  */
    154 #define TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE void
    155 #endif /* TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE */
    156 
    157 /**
    158  * Type of the function that receives the result of a
    159  * DELETE /private/orders/$ORDER_ID request.
    160  *
    161  * @param cls closure
    162  * @param result result returned by the HTTP server
    163  */
    164 typedef void
    165 (*TALER_MERCHANT_DeletePrivateOrderCallback)(
    166   TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE *cls,
    167   const struct TALER_MERCHANT_DeletePrivateOrderResponse *result);
    168 
    169 
    170 /**
    171  * Start DELETE /private/orders/$ORDER_ID operation.
    172  *
    173  * @param[in,out] handle operation to start
    174  * @param cb function to call with the result
    175  * @param cb_cls closure for @a cb
    176  * @return status code, #TALER_EC_NONE on success
    177  */
    178 enum TALER_ErrorCode
    179 TALER_MERCHANT_delete_private_order_start (
    180   struct TALER_MERCHANT_DeletePrivateOrderHandle *handle,
    181   TALER_MERCHANT_DeletePrivateOrderCallback cb,
    182   TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE *cb_cls);
    183 
    184 
    185 /**
    186  * Cancel DELETE /private/orders/$ORDER_ID operation.
    187  * This function must not be called by clients after the
    188  * callback has been invoked.
    189  *
    190  * @param[in] handle operation to cancel
    191  */
    192 void
    193 TALER_MERCHANT_delete_private_order_cancel (
    194   struct TALER_MERCHANT_DeletePrivateOrderHandle *handle);
    195 
    196 
    197 #endif /* _TALER_MERCHANT__DELETE_PRIVATE_ORDERS_ORDER_ID_H */