gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-sync] branch master updated: implement store_payment


From: gnunet
Subject: [taler-sync] branch master updated: implement store_payment
Date: Sun, 17 Nov 2019 17:39:01 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository sync.

The following commit(s) were added to refs/heads/master by this push:
     new d97f57a  implement store_payment
d97f57a is described below

commit d97f57a3b5743f854b4e4af43f011a159a7e5a45
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Nov 17 17:38:58 2019 +0100

    implement store_payment
---
 src/syncdb/plugin_syncdb_postgres.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/syncdb/plugin_syncdb_postgres.c 
b/src/syncdb/plugin_syncdb_postgres.c
index 95d39f1..2eea1d5 100644
--- a/src/syncdb/plugin_syncdb_postgres.c
+++ b/src/syncdb/plugin_syncdb_postgres.c
@@ -264,7 +264,39 @@ postgres_store_payment (void *cls,
                         const char *order_id,
                         const struct TALER_Amount *amount)
 {
-  // FIXME: use payment_insert
+  struct PostgresClosure *pg = cls;
+  enum GNUNET_DB_QueryStatus qs;
+  struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+  struct GNUNET_PQ_QueryParam params[] = {
+    GNUNET_PQ_query_param_auto_from_type (account_pub),
+    GNUNET_PQ_query_param_string (order_id),
+    GNUNET_PQ_query_param_absolute_time (&now),
+    TALER_PQ_query_param_amount (amount),
+    GNUNET_PQ_query_param_end
+  };
+
+  check_connection (pg);
+  postgres_preflight (pg);
+  qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
+                                           "payment_insert",
+                                           params);
+  switch (qs)
+  {
+  case GNUNET_DB_STATUS_SOFT_ERROR:
+    GNUNET_break (0);
+    return SYNC_DB_SOFT_ERROR;
+  case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+    GNUNET_break (0);
+    return SYNC_DB_NO_RESULTS;
+  case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+    return SYNC_DB_ONE_RESULT;
+  case GNUNET_DB_STATUS_HARD_ERROR:
+    GNUNET_break (0);
+    return SYNC_DB_HARD_ERROR;
+  default:
+    GNUNET_break (0);
+    return SYNC_DB_HARD_ERROR;
+  }
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]