gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] branch master updated: roll back transacti


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: roll back transaction if payment is insufficient
Date: Wed, 29 May 2019 16:59:13 +0200

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

dold pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new d33685e  roll back transaction if payment is insufficient
d33685e is described below

commit d33685e1966d1ae32d76a7d8f682435c5cd6e7af
Author: Florian Dold <address@hidden>
AuthorDate: Wed May 29 16:58:45 2019 +0200

    roll back transaction if payment is insufficient
---
 src/backend/taler-merchant-httpd_pay.c | 58 ++++++++++++++++++----------------
 1 file changed, 31 insertions(+), 27 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_pay.c 
b/src/backend/taler-merchant-httpd_pay.c
index ed2f0cd..2a91c77 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -1982,39 +1982,43 @@ begin_transaction (struct PayContext *pc)
     enum TALER_ErrorCode ec;
 
     ec = check_payment_sufficient (pc);
-    if (TALER_EC_NONE == ec)
+    if (TALER_EC_NONE != ec)
     {
-      /* Payment succeeded, commit! */
-      qs = db->mark_proposal_paid (db->cls,
-                                   &pc->h_contract_terms,
-                                   &pc->mi->pubkey,
-                                   pc->session_id);
-      if (0 <= qs)
-        qs = db->commit (db->cls);
-      else
-        db->rollback (db->cls);
-      if (0 > qs)
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Payment is not sufficient (ec=%u).\n",
+                  (unsigned int) ec);
+      db->rollback (db->cls);
+      generate_error_response (pc,
+                               ec);
+      return;
+    }
+    /* Payment succeeded, commit! */
+    qs = db->mark_proposal_paid (db->cls,
+                                 &pc->h_contract_terms,
+                                 &pc->mi->pubkey,
+                                 pc->session_id);
+    if (0 <= qs)
+      qs = db->commit (db->cls);
+    else
+      db->rollback (db->cls);
+    if (0 > qs)
+    {
+      if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
       {
-        if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-        {
-          begin_transaction (pc);
-          return;
-        }
-        resume_pay_with_error
-          (pc,
-           MHD_HTTP_INTERNAL_SERVER_ERROR,
-           TALER_EC_PAY_DB_STORE_PAYMENTS_ERROR,
-           "Merchant database error: could not "
-           "mark proposal as 'paid'");
+        begin_transaction (pc);
         return;
       }
-      resume_pay_with_response (pc,
-                                MHD_HTTP_OK,
-                                sign_success_response (pc));
+      resume_pay_with_error
+        (pc,
+         MHD_HTTP_INTERNAL_SERVER_ERROR,
+         TALER_EC_PAY_DB_STORE_PAYMENTS_ERROR,
+         "Merchant database error: could not "
+         "mark proposal as 'paid'");
       return;
     }
-    generate_error_response (pc,
-                             ec);
+    resume_pay_with_response (pc,
+                              MHD_HTTP_OK,
+                              sign_success_response (pc));
     return;
   }
 

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



reply via email to

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