[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 252/277: minor style improvements
From: |
gnunet |
Subject: |
[taler-merchant] 252/277: minor style improvements |
Date: |
Sun, 05 Jul 2020 20:52:45 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit 6bca914c824a5f9b42b8f90094d62da1f25c88b0
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Jun 25 10:42:37 2020 +0200
minor style improvements
---
src/backend/taler-merchant-httpd_get-orders-ID.c | 59 ++++++++--------------
...-merchant-httpd_private-post-orders-ID-refund.c | 2 +-
src/backenddb/plugin_merchantdb_postgres.c | 2 -
3 files changed, 23 insertions(+), 40 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c
b/src/backend/taler-merchant-httpd_get-orders-ID.c
index 1a7c16a..40c50de 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -207,7 +207,7 @@ struct GetOrderData
/**
* Did we suspend @a connection?
*/
- int suspended;
+ bool suspended;
/**
* Return code: #TALER_EC_NONE if successful.
@@ -248,7 +248,7 @@ TMH_force_wallet_get_order_resume (void)
god_tail,
god);
GNUNET_assert (god->suspended);
- god->suspended = GNUNET_NO;
+ god->suspended = false;
MHD_resume_connection (god->sc.con);
}
}
@@ -422,7 +422,7 @@ check_resume_god (struct GetOrderData *god)
god_tail,
god);
GNUNET_assert (god->suspended);
- god->suspended = GNUNET_NO;
+ god->suspended = false;
MHD_resume_connection (god->sc.con);
TMH_trigger_daemon ();
}
@@ -580,14 +580,13 @@ process_refunds_cb (void *cls,
/**
- * Clean up the session state for a GET /orders/$ID request.
+ * Clean up refund processing.
*
- * @param cls must be a `struct GetOrderData *`
+ * @param god handle to clean up refund processing for
*/
static void
-god_cleanup (void *cls)
+rf_cleanup (struct GetOrderData *god)
{
- struct GetOrderData *god = cls;
struct CoinRefund *cr;
while (NULL != (cr = god->cr_head))
@@ -613,7 +612,20 @@ god_cleanup (void *cls)
GNUNET_free (cr->exchange_url);
GNUNET_free (cr);
}
+}
+
+
+/**
+ * Clean up the session state for a GET /orders/$ID request.
+ *
+ * @param cls must be a `struct GetOrderData *`
+ */
+static void
+god_cleanup (void *cls)
+{
+ struct GetOrderData *god = cls;
+ rf_cleanup (god);
if (NULL != god->contract_terms)
json_decref (god->contract_terms);
GNUNET_free (god);
@@ -643,10 +655,8 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
hc->ctx = god;
hc->cc = &god_cleanup;
god->sc.con = connection;
- god->ec = TALER_EC_NONE;
god->hc = hc;
god->order_id = order_id;
- god->cr_head = NULL;
{
const char *cts;
@@ -889,33 +899,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
/* At this point, we know the contract was paid. Let's check for
refunds. First, clear away refunds found from previous invocations. */
- {
- struct CoinRefund *cr;
-
- while (NULL != (cr = god->cr_head))
- {
- GNUNET_CONTAINER_DLL_remove (god->cr_head,
- god->cr_tail,
- cr);
- if (NULL != cr->fo)
- {
- TMH_EXCHANGES_find_exchange_cancel (cr->fo);
- cr->fo = NULL;
- }
- if (NULL != cr->rh)
- {
- TALER_EXCHANGE_refund_cancel (cr->rh);
- cr->rh = NULL;
- }
- if (NULL != cr->exchange_reply)
- {
- json_decref (cr->exchange_reply);
- cr->exchange_reply = NULL;
- }
- GNUNET_free (cr->exchange_url);
- GNUNET_free (cr);
- }
- }
+ rf_cleanup ();
GNUNET_assert (GNUNET_OK == TALER_amount_get_zero (TMH_currency,
&god->refund_amount));
qs = TMH_db->lookup_refunds_detailed (TMH_db->cls,
@@ -993,7 +977,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
{
if (! god->suspended)
{
- god->suspended = GNUNET_YES;
+ god->suspended = true;
MHD_suspend_connection (connection);
GNUNET_CONTAINER_DLL_insert (god_head,
god_tail,
@@ -1013,6 +997,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
cr = cr->next)
{
json_t *refund;
+
if (MHD_HTTP_OK != cr->exchange_status)
{
if (NULL == cr->exchange_reply)
diff --git a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
index 942892f..d585b10 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
@@ -203,7 +203,7 @@ TMH_private_post_orders_ID_refund (const struct
TMH_RequestHandler *rh,
{
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_CONFLICT,
- TALER_EC_REFUND_ORDER_ID_UNKNOWN,
+ TALER_EC_REFUND_ORDER_ID_UNPAID,
"Order never paid");
}
else
diff --git a/src/backenddb/plugin_merchantdb_postgres.c
b/src/backenddb/plugin_merchantdb_postgres.c
index b5c9ad0..ba08d93 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -2775,11 +2775,9 @@ process_deposits_for_refund_cb (void *cls,
GNUNET_break (0);
ctx->rs = TALER_MERCHANTDB_RS_HARD_ERROR;
return;
- break;
case GNUNET_DB_STATUS_SOFT_ERROR:
ctx->rs = TALER_MERCHANTDB_RS_SOFT_ERROR;
return;
- break;
default:
ctx->rs = qs;
break;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] 225/277: stricter tests for query reserve(s) methods, (continued)
- [taler-merchant] 225/277: stricter tests for query reserve(s) methods, gnunet, 2020/07/05
- [taler-merchant] 228/277: start with reserve processing logic, gnunet, 2020/07/05
- [taler-merchant] 227/277: implement library method for DELETE /orders/ and tests, gnunet, 2020/07/05
- [taler-merchant] 231/277: address 413 fixme, gnunet, 2020/07/05
- [taler-merchant] 237/277: fix type conversion warning and test failure for backenddb, gnunet, 2020/07/05
- [taler-merchant] 239/277: more checks for GET /private/products/, gnunet, 2020/07/05
- [taler-merchant] 242/277: also parse and return timestamp and row_id, gnunet, 2020/07/05
- [taler-merchant] 250/277: got refunds working and tested, gnunet, 2020/07/05
- [taler-merchant] 245/277: DCE: removing legacy code and APIs, gnunet, 2020/07/05
- [taler-merchant] 246/277: implement taler-merchant-setup-reserve CLI tool, gnunet, 2020/07/05
- [taler-merchant] 252/277: minor style improvements,
gnunet <=
- [taler-merchant] 253/277: fix FIXME, gnunet, 2020/07/05
- [taler-merchant] 254/277: logic to update 'wired' status of an order, gnunet, 2020/07/05
- [taler-merchant] 255/277: deeper checks for merchant get order, gnunet, 2020/07/05
- [taler-merchant] 248/277: deeper checks on GET /private/orders, gnunet, 2020/07/05
- [taler-merchant] 241/277: clarify with/without wire fee issue, gnunet, 2020/07/05
- [taler-merchant] 244/277: use and handle all /pay status codes, gnunet, 2020/07/05
- [taler-merchant] 247/277: harder tests for GET /private/instances, GET /private/products, gnunet, 2020/07/05
- [taler-merchant] 249/277: made a testing trait for order claim nonce, gnunet, 2020/07/05
- [taler-merchant] 251/277: wallet get order handles refunds properly, gnunet, 2020/07/05
- [taler-merchant] 256/277: test for auto marking orders as wired after inserting sufficient transfers, gnunet, 2020/07/05