merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit a046a9c17ccd5861fe2e44de0b77e9bf1daaacad
parent d2d2d773cb2cc23f198d07392bab463beb2e2e04
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  4 Jan 2024 01:06:25 +0100

remove silly code duplication

Diffstat:
Msrc/backend/taler-merchant-httpd_private-get-orders-ID.c | 44+++++++++++++-------------------------------
Msrc/backend/taler-merchant-webhook.c | 4++--
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 @@ -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 @@ -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 */