summaryrefslogtreecommitdiff
path: root/src/backenddb/pg_lookup_payment_status.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backenddb/pg_lookup_payment_status.c')
-rw-r--r--src/backenddb/pg_lookup_payment_status.c98
1 files changed, 0 insertions, 98 deletions
diff --git a/src/backenddb/pg_lookup_payment_status.c b/src/backenddb/pg_lookup_payment_status.c
deleted file mode 100644
index fc4e5d94..00000000
--- a/src/backenddb/pg_lookup_payment_status.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2022 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU 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 backenddb/pg_lookup_payment_status.c
- * @brief Implementation of the lookup_payment_status function for Postgres
- * @author Iván Ávalos
- */
-#include "platform.h"
-#include <taler/taler_error_codes.h>
-#include <taler/taler_dbevents.h>
-#include <taler/taler_pq_lib.h>
-#include "pg_lookup_payment_status.h"
-#include "pg_helper.h"
-
-enum GNUNET_DB_QueryStatus
-TMH_PG_lookup_payment_status (void *cls,
- uint64_t order_serial,
- const char *session_id,
- bool *paid,
- bool *wired)
-{
- struct PostgresClosure *pg = cls;
- uint8_t paid8;
- uint8_t wired8;
- enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_auto_from_type ("paid",
- &paid8),
- GNUNET_PQ_result_spec_auto_from_type ("wired",
- &wired8),
- GNUNET_PQ_result_spec_end
- };
- check_connection (pg);
- if (NULL == session_id)
- {
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint64 (&order_serial),
- GNUNET_PQ_query_param_end
- };
-
- PREPARE (pg,
- "lookup_payment_status",
- "SELECT"
- " wired"
- ",paid"
- " FROM merchant_contract_terms"
- " WHERE order_serial=$1");
- qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "lookup_payment_status",
- params,
- rs);
- }
- else
- {
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint64 (&order_serial),
- GNUNET_PQ_query_param_string (session_id),
- GNUNET_PQ_query_param_end
- };
-
- PREPARE (pg,
- "lookup_payment_status_session_id",
- "SELECT"
- " wired"
- ",paid"
- " FROM merchant_contract_terms"
- " WHERE order_serial=$1"
- " AND session_id=$2");
- qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "lookup_payment_status_session_id",
- params,
- rs);
- }
- if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
- {
- *paid = (0 != paid8);
- *wired = (0 != wired8);
- }
- else
- {
- *paid = false; /* just to be safe(r) */
- *wired = false; /* just to be safe(r) */
- }
- return qs;
-}