merchantdb_helper.c (3183B)
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 "taler/platform.h" 23 #include <taler/taler_util.h> 24 #include "taler/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 GNUNET_free (pd->image_hash); 40 json_decref (pd->address); 41 pd->address = NULL; 42 GNUNET_free (pd->price_array); 43 pd->price_array = NULL; 44 pd->price_array_length = 0; 45 } 46 47 48 void 49 TALER_MERCHANTDB_template_details_free ( 50 struct TALER_MERCHANTDB_TemplateDetails *tp) 51 { 52 GNUNET_free (tp->template_description); 53 GNUNET_free (tp->otp_id); 54 json_decref (tp->editable_defaults); 55 tp->editable_defaults = NULL; 56 json_decref (tp->template_contract); 57 tp->template_contract = NULL; 58 } 59 60 61 void 62 TALER_MERCHANTDB_webhook_details_free ( 63 struct TALER_MERCHANTDB_WebhookDetails *wb) 64 { 65 GNUNET_free (wb->event_type); 66 GNUNET_free (wb->url); 67 GNUNET_free (wb->http_method); 68 GNUNET_free (wb->header_template); 69 GNUNET_free (wb->body_template); 70 } 71 72 73 void 74 TALER_MERCHANTDB_pending_webhook_details_free ( 75 struct TALER_MERCHANTDB_PendingWebhookDetails *pwb) 76 { 77 GNUNET_free (pwb->url); 78 GNUNET_free (pwb->http_method); 79 GNUNET_free (pwb->header); 80 GNUNET_free (pwb->body); 81 } 82 83 84 void 85 TALER_MERCHANTDB_token_family_details_free ( 86 struct TALER_MERCHANTDB_TokenFamilyDetails *tf) 87 { 88 GNUNET_free (tf->slug); 89 GNUNET_free (tf->name); 90 GNUNET_free (tf->description); 91 json_decref (tf->description_i18n); 92 tf->description_i18n = NULL; 93 json_decref (tf->extra_data); 94 tf->extra_data = NULL; 95 GNUNET_free (tf->cipher_spec); 96 } 97 98 99 void 100 TALER_MERCHANTDB_category_details_free ( 101 struct TALER_MERCHANTDB_CategoryDetails *cd) 102 { 103 GNUNET_free (cd->category_name); 104 json_decref (cd->category_name_i18n); 105 cd->category_name_i18n = NULL; 106 } 107 108 109 void 110 TALER_MERCHANTDB_unit_details_free ( 111 struct TALER_MERCHANTDB_UnitDetails *ud) 112 { 113 GNUNET_free (ud->unit); 114 GNUNET_free (ud->unit_name_long); 115 GNUNET_free (ud->unit_name_short); 116 json_decref (ud->unit_name_long_i18n); 117 ud->unit_name_long_i18n = NULL; 118 json_decref (ud->unit_name_short_i18n); 119 ud->unit_name_short_i18n = NULL; 120 } 121 122 123 /* end of merchantdb_helper.c */