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