LCOV - code coverage report
Current view: top level - backenddb - merchantdb_helper.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 26 47 55.3 %
Date: 2025-06-23 16:22:09 Functions: 3 6 50.0 %

          Line data    Source code
       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           3 : TALER_MERCHANTDB_product_details_free (
      29             :   struct TALER_MERCHANTDB_ProductDetails *pd)
      30             : {
      31           3 :   GNUNET_free (pd->description);
      32           3 :   json_decref (pd->description_i18n);
      33           3 :   pd->description_i18n = NULL;
      34           3 :   GNUNET_free (pd->unit);
      35           3 :   json_decref (pd->taxes);
      36           3 :   pd->taxes = NULL;
      37           3 :   GNUNET_free (pd->image);
      38           3 :   json_decref (pd->address);
      39           3 :   pd->address = NULL;
      40           3 : }
      41             : 
      42             : 
      43             : void
      44          22 : TALER_MERCHANTDB_template_details_free (
      45             :   struct TALER_MERCHANTDB_TemplateDetails *tp)
      46             : {
      47          22 :   GNUNET_free (tp->template_description);
      48          22 :   GNUNET_free (tp->otp_id);
      49          22 :   json_decref (tp->editable_defaults);
      50          22 :   tp->editable_defaults = NULL;
      51          22 :   json_decref (tp->template_contract);
      52          22 :   tp->template_contract = NULL;
      53          22 : }
      54             : 
      55             : 
      56             : void
      57           4 : TALER_MERCHANTDB_webhook_details_free (
      58             :   struct TALER_MERCHANTDB_WebhookDetails *wb)
      59             : {
      60           4 :   GNUNET_free (wb->event_type);
      61           4 :   GNUNET_free (wb->url);
      62           4 :   GNUNET_free (wb->http_method);
      63           4 :   GNUNET_free (wb->header_template);
      64           4 :   GNUNET_free (wb->body_template);
      65           4 : }
      66             : 
      67             : 
      68             : void
      69           0 : TALER_MERCHANTDB_pending_webhook_details_free (
      70             :   struct TALER_MERCHANTDB_PendingWebhookDetails *pwb)
      71             : {
      72           0 :   GNUNET_free (pwb->url);
      73           0 :   GNUNET_free (pwb->http_method);
      74           0 :   GNUNET_free (pwb->header);
      75           0 :   GNUNET_free (pwb->body);
      76           0 : }
      77             : 
      78             : 
      79             : void
      80           0 : TALER_MERCHANTDB_token_family_details_free (
      81             :   struct TALER_MERCHANTDB_TokenFamilyDetails *tf)
      82             : {
      83           0 :   GNUNET_free (tf->slug);
      84           0 :   GNUNET_free (tf->name);
      85           0 :   GNUNET_free (tf->description);
      86           0 :   json_decref (tf->description_i18n);
      87           0 :   tf->description_i18n = NULL;
      88           0 :   json_decref (tf->extra_data);
      89           0 :   tf->extra_data = NULL;
      90           0 :   GNUNET_free (tf->cipher_spec);
      91           0 : }
      92             : 
      93             : 
      94             : void
      95           0 : TALER_MERCHANTDB_category_details_free (
      96             :   struct TALER_MERCHANTDB_CategoryDetails *cd)
      97             : {
      98           0 :   GNUNET_free (cd->category_name);
      99           0 :   json_decref (cd->category_name_i18n);
     100           0 :   cd->category_name_i18n = NULL;
     101           0 : }
     102             : 
     103             : 
     104             : /* end of merchantdb_helper.c */

Generated by: LCOV version 1.16