merchant

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

merchantdb_helper.c (3139B)


      1 /*
      2   This file is part of TALER
      3   Copyright (C) 2021 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 3, 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 General Public License for more details.
     12 
     13   You should have received a copy of the GNU General Public License along with
     14   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 */
     16 /**
     17  * @file merchantdb_helper.c
     18  * @brief Helper functions for the merchant database logic
     19  * @author Christian Grothoff
     20  * @author Priscilla Huang
     21  */
     22 #include "platform.h"
     23 #include <taler/taler_util.h>
     24 #include "taler_merchantdb_lib.h"
     25 
     26 
     27 void
     28 TALER_MERCHANTDB_product_details_free (
     29   struct TALER_MERCHANTDB_ProductDetails *pd)
     30 {
     31   GNUNET_free (pd->product_name);
     32   GNUNET_free (pd->description);
     33   json_decref (pd->description_i18n);
     34   pd->description_i18n = NULL;
     35   GNUNET_free (pd->unit);
     36   json_decref (pd->taxes);
     37   pd->taxes = NULL;
     38   GNUNET_free (pd->image);
     39   json_decref (pd->address);
     40   pd->address = NULL;
     41   GNUNET_free (pd->price_array);
     42   pd->price_array = NULL;
     43   pd->price_array_length = 0;
     44 }
     45 
     46 
     47 void
     48 TALER_MERCHANTDB_template_details_free (
     49   struct TALER_MERCHANTDB_TemplateDetails *tp)
     50 {
     51   GNUNET_free (tp->template_description);
     52   GNUNET_free (tp->otp_id);
     53   json_decref (tp->editable_defaults);
     54   tp->editable_defaults = NULL;
     55   json_decref (tp->template_contract);
     56   tp->template_contract = NULL;
     57 }
     58 
     59 
     60 void
     61 TALER_MERCHANTDB_webhook_details_free (
     62   struct TALER_MERCHANTDB_WebhookDetails *wb)
     63 {
     64   GNUNET_free (wb->event_type);
     65   GNUNET_free (wb->url);
     66   GNUNET_free (wb->http_method);
     67   GNUNET_free (wb->header_template);
     68   GNUNET_free (wb->body_template);
     69 }
     70 
     71 
     72 void
     73 TALER_MERCHANTDB_pending_webhook_details_free (
     74   struct TALER_MERCHANTDB_PendingWebhookDetails *pwb)
     75 {
     76   GNUNET_free (pwb->url);
     77   GNUNET_free (pwb->http_method);
     78   GNUNET_free (pwb->header);
     79   GNUNET_free (pwb->body);
     80 }
     81 
     82 
     83 void
     84 TALER_MERCHANTDB_token_family_details_free (
     85   struct TALER_MERCHANTDB_TokenFamilyDetails *tf)
     86 {
     87   GNUNET_free (tf->slug);
     88   GNUNET_free (tf->name);
     89   GNUNET_free (tf->description);
     90   json_decref (tf->description_i18n);
     91   tf->description_i18n = NULL;
     92   json_decref (tf->extra_data);
     93   tf->extra_data = NULL;
     94   GNUNET_free (tf->cipher_spec);
     95 }
     96 
     97 
     98 void
     99 TALER_MERCHANTDB_category_details_free (
    100   struct TALER_MERCHANTDB_CategoryDetails *cd)
    101 {
    102   GNUNET_free (cd->category_name);
    103   json_decref (cd->category_name_i18n);
    104   cd->category_name_i18n = NULL;
    105 }
    106 
    107 
    108 void
    109 TALER_MERCHANTDB_unit_details_free (
    110   struct TALER_MERCHANTDB_UnitDetails *ud)
    111 {
    112   GNUNET_free (ud->unit);
    113   GNUNET_free (ud->unit_name_long);
    114   GNUNET_free (ud->unit_name_short);
    115   json_decref (ud->unit_name_long_i18n);
    116   ud->unit_name_long_i18n = NULL;
    117   json_decref (ud->unit_name_short_i18n);
    118   ud->unit_name_short_i18n = NULL;
    119 }
    120 
    121 
    122 /* end of merchantdb_helper.c */