summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-01-04 01:06:25 +0100
committerChristian Grothoff <christian@grothoff.org>2024-01-04 01:06:25 +0100
commita046a9c17ccd5861fe2e44de0b77e9bf1daaacad (patch)
treee4f6a903f55a47798f42ee465dbf85d55cf08156 /src/backend
parentd2d2d773cb2cc23f198d07392bab463beb2e2e04 (diff)
downloadmerchant-a046a9c17ccd5861fe2e44de0b77e9bf1daaacad.tar.gz
merchant-a046a9c17ccd5861fe2e44de0b77e9bf1daaacad.tar.bz2
merchant-a046a9c17ccd5861fe2e44de0b77e9bf1daaacad.zip
remove silly code duplication
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders-ID.c44
-rw-r--r--src/backend/taler-merchant-webhook.c4
2 files changed, 15 insertions, 33 deletions
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
index a19c64a4..4f7959bd 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -885,7 +885,6 @@ static void
phase_check_paid (struct GetOrderRequestContext *gorc)
{
struct TMH_HandlerContext *hc = gorc->hc;
- enum GNUNET_DB_QueryStatus qs;
if (gorc->order_only)
{
@@ -1048,22 +1047,21 @@ phase_unpaid_finish (struct GetOrderRequestContext *gorc)
}
/* User never paid for this order, suspend waiting
on payment or return details. */
-
+ if (GNUNET_TIME_absolute_is_future (gorc->sc.long_poll_timeout))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Suspending GET /private/orders/%s\n",
+ hc->infix);
+ GNUNET_CONTAINER_DLL_insert (gorc_head,
+ gorc_tail,
+ gorc);
+ gorc->phase = GOP_SUSPENDED_ON_UNPAID;
+ gorc->suspended = GNUNET_YES;
+ MHD_suspend_connection (gorc->sc.con);
+ return;
+ }
if (! gorc->order_only)
{
- if (GNUNET_TIME_absolute_is_future (gorc->sc.long_poll_timeout))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Suspending GET /private/orders/%s\n",
- hc->infix);
- GNUNET_CONTAINER_DLL_insert (gorc_head,
- gorc_tail,
- gorc);
- gorc->phase = GOP_SUSPENDED_ON_UNPAID;
- gorc->suspended = GNUNET_YES;
- MHD_suspend_connection (gorc->sc.con);
- return;
- }
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Order %s claimed but not paid yet\n",
hc->infix);
@@ -1077,22 +1075,6 @@ phase_unpaid_finish (struct GetOrderRequestContext *gorc)
"claimed")));
return;
}
-
- /* FIXME: too similar to logic above! */
- if (GNUNET_TIME_absolute_is_future (gorc->sc.long_poll_timeout))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Suspending GET /private/orders/%s\n",
- hc->infix);
- GNUNET_assert (GNUNET_NO == gorc->suspended);
- GNUNET_CONTAINER_DLL_insert (gorc_head,
- gorc_tail,
- gorc);
- gorc->suspended = GNUNET_YES;
- gorc->phase = GOP_SUSPENDED_ON_UNPAID;
- MHD_suspend_connection (gorc->sc.con);
- return;
- }
taler_pay_uri = TMH_make_taler_pay_uri (gorc->sc.con,
hc->infix,
gorc->session_id,
diff --git a/src/backend/taler-merchant-webhook.c b/src/backend/taler-merchant-webhook.c
index 721153fa..99ab76d5 100644
--- a/src/backend/taler-merchant-webhook.c
+++ b/src/backend/taler-merchant-webhook.c
@@ -45,7 +45,7 @@ static struct WorkResponse *w_tail;
static struct GNUNET_DB_EventHandler *eh;
/**
- * The exchange's configuration.
+ * The merchant's configuration.
*/
static const struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -585,4 +585,4 @@ main (int argc,
}
-/* end of taler-exchange-transfer.c */
+/* end of taler-merchant-webhook.c */