aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorMS <ms@taler.net>2020-10-09 18:00:33 +0200
committerMS <ms@taler.net>2020-10-09 18:00:33 +0200
commit95c2f2ce13dbdfa43a1e8fe01619a637ab269107 (patch)
treebbd4b3f42b83802298c6fbbe0261db7a860f4520 /src/backend
parent6868ab03e1ba252ac47f3c38b5f802e265541cd3 (diff)
addressing some of the @file warnings
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd.c2
-rw-r--r--src/backend/taler-merchant-httpd.h2
-rw-r--r--src/backend/taler-merchant-httpd_OBSOLETE.c195
-rw-r--r--src/backend/taler-merchant-httpd_private-patch-instances-ID.c2
-rw-r--r--src/backend/taler-merchant-httpd_private-patch-products-ID.c2
-rw-r--r--src/backend/taler-merchant-httpd_qr.c2
-rw-r--r--src/backend/taler-merchant-httpd_qr.h2
-rw-r--r--src/backend/taler-merchant-httpd_statics.c2
-rw-r--r--src/backend/taler-merchant-httpd_statics.h2
-rw-r--r--src/backend/taler-merchant-httpd_templating.c2
-rw-r--r--src/backend/taler-merchant-httpd_templating.h2
11 files changed, 10 insertions, 205 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index bf8de66d..91c3c693 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file merchant/backend/taler-merchant-httpd.c
+ * @file taler-merchant-httpd.c
* @brief HTTP serving layer intended to perform crypto-work and
* communication with the exchange
* @author Marcello Stanisci
diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h
index c631729d..2e33b852 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file merchant/backend/taler-merchant-httpd.h
+ * @file taler-merchant-httpd.h
* @brief HTTP serving layer mainly intended to communicate with the frontend
* @author Marcello Stanisci
*/
diff --git a/src/backend/taler-merchant-httpd_OBSOLETE.c b/src/backend/taler-merchant-httpd_OBSOLETE.c
deleted file mode 100644
index 62ebf451..00000000
--- a/src/backend/taler-merchant-httpd_OBSOLETE.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- This file is part of TALER
- (C) 2014-2020 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file backend/taler-merchant-httpd_refund.c
- * @brief HTTP serving layer mainly intended to communicate with the frontend
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include <jansson.h>
-#include <taler/taler_signatures.h>
-#include <taler/taler_json_lib.h>
-#include "taler-merchant-httpd.h"
-#include "taler-merchant-httpd_refund.h"
-
-/**
- * How often do we retry the non-trivial refund INSERT database
- * transaction?
- */
-#define MAX_RETRIES 5
-
-
-/**
- * Closure for #process_refunds_cb.
- */
-struct ProcessRefundData
-{
- /**
- * The array containing all the refund permissions.
- */
- json_t *response;
-
- /**
- * Hashed version of contract terms; needed by the callback
- * to pack the response.
- */
- const struct GNUNET_HashCode *h_contract_terms;
-
- /**
- * Both public and private key are needed by the callback
- */
- const struct MerchantInstance *merchant;
-
- /**
- * Return code: #TALER_EC_NONE if successful.
- */
- enum TALER_ErrorCode ec;
-};
-
-
-/**
- * Function called with information about a refund.
- * It is responsible for packing up the data to return.
- *
- * @param cls closure
- * @param coin_pub public coin from which the refund comes from
- * @param exchange_url URL of the exchange that issued @a coin_pub
- * @param rtransaction_id identificator of the refund
- * @param reason human-readable explanation of the refund
- * @param refund_amount refund amount which is being taken from @a coin_pub
- * @param refund_fee cost of this refund operation
- */
-static void
-process_refunds_cb (void *cls,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const char *exchange_url,
- uint64_t rtransaction_id,
- const char *reason,
- const struct TALER_Amount *refund_amount,
- const struct TALER_Amount *refund_fee)
-{
- struct ProcessRefundData *prd = cls;
- struct GNUNET_CRYPTO_EddsaSignature sig;
- json_t *element;
-
- (void) exchange_url;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Found refund of %s for coin %s with reason `%s' in database\n",
- TALER_B2S (coin_pub),
- TALER_amount2s (refund_amount),
- reason);
- {
- struct TALER_RefundRequestPS rr = {
- .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND),
- .purpose.size = htonl (sizeof (rr)),
- .h_contract_terms = *prd->h_contract_terms,
- .coin_pub = *coin_pub,
- .merchant = prd->merchant->pubkey,
- .rtransaction_id = GNUNET_htonll (rtransaction_id)
- };
-
- TALER_amount_hton (&rr.refund_amount,
- refund_amount);
- TALER_amount_hton (&rr.refund_fee,
- refund_fee);
- GNUNET_CRYPTO_eddsa_sign (&prd->merchant->privkey.eddsa_priv,
- &rr,
- &sig);
- }
-
- element = json_pack ("{s:o, s:o, s:o, s:I, s:o}",
- "refund_amount", TALER_JSON_from_amount (refund_amount),
- "refund_fee", TALER_JSON_from_amount (refund_fee),
- "coin_pub", GNUNET_JSON_from_data_auto (coin_pub),
- "rtransaction_id", (json_int_t) rtransaction_id,
- "merchant_sig", GNUNET_JSON_from_data_auto (&sig));
- if (NULL == element)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Could not pack refund response element\n");
- prd->ec = TALER_EC_PARSER_OUT_OF_MEMORY;
- return;
- }
- if (-1 == json_array_append_new (prd->response,
- element))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Could not append a response's element\n");
- prd->ec = TALER_EC_PARSER_OUT_OF_MEMORY;
- return;
- }
-}
-
-
-/**
- * Get the JSON representation of a refund.
- *
- * @param merchant_pub the merchant's public key
- * @param mi merchant instance
- * @param ret_ec where to store error code
- * @param ret_errmsg where to store error message
- * @return NULL on error, JSON array with refunds on success
- */
-json_t *
-TM_get_refund_json (const struct MerchantInstance *mi,
- const struct GNUNET_HashCode *h_contract_terms,
- enum TALER_ErrorCode *ret_ec,
- const char **ret_errmsg)
-{
- enum GNUNET_DB_QueryStatus qs;
- struct ProcessRefundData prd;
-
- prd.response = json_array ();
- if (NULL == prd.response)
- {
- GNUNET_break (0);
- return NULL;
- }
- prd.h_contract_terms = h_contract_terms;
- prd.merchant = mi;
- prd.ec = TALER_EC_NONE;
- db->preflight (db->cls);
- for (unsigned int i = 0; i<MAX_RETRIES; i++)
- {
- qs = db->get_refunds_from_contract_terms_hash (db->cls,
- &mi->pubkey,
- h_contract_terms,
- &process_refunds_cb,
- &prd);
- if (GNUNET_DB_STATUS_SOFT_ERROR != qs)
- break;
- }
- if (0 > qs)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Database hard error on refunds_from_contract_terms_hash lookup: %s\n",
- GNUNET_h2s (h_contract_terms));
- json_decref (prd.response);
- *ret_ec = TALER_EC_REFUND_LOOKUP_DB_ERROR;
- *ret_errmsg = "Failed to lookup refunds for contract";
- }
- if (TALER_EC_NONE != prd.ec)
- {
- json_decref (prd.response);
- /* NOTE: error already logged by the callback */
- *ret_ec = prd.ec;
- *ret_errmsg = "Could not generate a response";
- }
- return prd.response;
-}
-
-
-/* end of taler-merchant-httpd_refund.c */
diff --git a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
index 94c02ea4..94ecca45 100644
--- a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
@@ -18,7 +18,7 @@
*/
/**
- * @file backend/taler-merchant-httpd_private-patch-instances.c
+ * @file taler-merchant-httpd_private-patch-instances-ID.c
* @brief implementing PATCH /instances/$ID request handling
* @author Christian Grothoff
*/
diff --git a/src/backend/taler-merchant-httpd_private-patch-products-ID.c b/src/backend/taler-merchant-httpd_private-patch-products-ID.c
index 0d722b5f..5fd3a1ef 100644
--- a/src/backend/taler-merchant-httpd_private-patch-products-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-products-ID.c
@@ -18,7 +18,7 @@
*/
/**
- * @file backend/taler-merchant-httpd_private-patch-products.c
+ * @file taler-merchant-httpd_private-patch-products-ID.c
* @brief implementing PATCH /products/$ID request handling
* @author Christian Grothoff
*/
diff --git a/src/backend/taler-merchant-httpd_qr.c b/src/backend/taler-merchant-httpd_qr.c
index 1774f75b..4539beed 100644
--- a/src/backend/taler-merchant-httpd_qr.c
+++ b/src/backend/taler-merchant-httpd_qr.c
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file merchant/backend/taler-merchant-httpd_qr.c
+ * @file taler-merchant-httpd_qr.c
* @brief logic to create QR codes in HTML
* @author Christian Grothoff
*/
diff --git a/src/backend/taler-merchant-httpd_qr.h b/src/backend/taler-merchant-httpd_qr.h
index ffcb0049..2a91d7ce 100644
--- a/src/backend/taler-merchant-httpd_qr.h
+++ b/src/backend/taler-merchant-httpd_qr.h
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file merchant/backend/taler-merchant-httpd_qr.h
+ * @file taler-merchant-httpd_qr.h
* @brief logic to create QR codes in HTML
* @author Christian Grothoff
*/
diff --git a/src/backend/taler-merchant-httpd_statics.c b/src/backend/taler-merchant-httpd_statics.c
index e8be2cba..3d852aeb 100644
--- a/src/backend/taler-merchant-httpd_statics.c
+++ b/src/backend/taler-merchant-httpd_statics.c
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file merchant/backend/taler-merchant-httpd_statics.c
+ * @file taler-merchant-httpd_statics.c
* @brief logic to load and complete HTML templates
* @author Christian Grothoff
*/
diff --git a/src/backend/taler-merchant-httpd_statics.h b/src/backend/taler-merchant-httpd_statics.h
index dac06a0d..271d28eb 100644
--- a/src/backend/taler-merchant-httpd_statics.h
+++ b/src/backend/taler-merchant-httpd_statics.h
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file merchant/backend/taler-merchant-httpd_statics.h
+ * @file taler-merchant-httpd_statics.h
* @brief logic to preload and serve static files
* @author Christian Grothoff
*/
diff --git a/src/backend/taler-merchant-httpd_templating.c b/src/backend/taler-merchant-httpd_templating.c
index 3d189a75..b604f6ba 100644
--- a/src/backend/taler-merchant-httpd_templating.c
+++ b/src/backend/taler-merchant-httpd_templating.c
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file merchant/backend/taler-merchant-httpd_templating.c
+ * @file taler-merchant-httpd_templating.c
* @brief logic to load and complete HTML templates
* @author Christian Grothoff
*/
diff --git a/src/backend/taler-merchant-httpd_templating.h b/src/backend/taler-merchant-httpd_templating.h
index 6f22e791..1fb4781a 100644
--- a/src/backend/taler-merchant-httpd_templating.h
+++ b/src/backend/taler-merchant-httpd_templating.h
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file merchant/backend/taler-merchant-httpd_templating.h
+ * @file taler-merchant-httpd_templating.h
* @brief logic to load and complete HTML templates
* @author Christian Grothoff
*/