gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: -update pay to return confirmati


From: gnunet
Subject: [taler-merchant] branch master updated: -update pay to return confirmation code
Date: Tue, 21 Feb 2023 13:00:55 +0100

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

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new c1976d63 -update pay to return confirmation code
c1976d63 is described below

commit c1976d63028260964cf0eda49ab7b6892e23c647
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Feb 21 13:00:53 2023 +0100

    -update pay to return confirmation code
---
 .../taler-merchant-httpd_post-orders-ID-pay.c      | 26 ++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c 
b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
index e9f7895d..9b9b1a00 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -1,6 +1,6 @@
 /*
    This file is part of TALER
-   (C) 2014-2022 Taler Systems SA
+   (C) 2014-2023 Taler Systems SA
 
    TALER is free software; you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
@@ -367,6 +367,16 @@ struct PayContext
    */
   struct GNUNET_TIME_Timestamp pay_deadline;
 
+  /**
+   * Set to the POS key, if applicable for this order.
+   */
+  char *pos_key;
+
+  /**
+   * Algorithm chosen for generating the confirmation code.
+   */
+  enum TALER_MerchantConfirmationAlgorithm pos_alg;
+
   /**
    * Number of transactions that the wire fees are expected to be
    * amortized over.  Never zero, defaults (conservateively) to 1.
@@ -716,6 +726,7 @@ pay_context_cleanup (void *cls)
   GNUNET_CONTAINER_DLL_remove (pc_head,
                                pc_tail,
                                pc);
+  GNUNET_free (pc->pos_key);
   GNUNET_free (pc);
 }
 
@@ -1947,6 +1958,7 @@ static void
 generate_success_response (struct PayContext *pc)
 {
   struct GNUNET_CRYPTO_EddsaSignature sig;
+  char *pos_confirmation;
 
   /* Sign on our end (as the payment did go through, even if it may
      have been refunded already) */
@@ -1954,12 +1966,22 @@ generate_success_response (struct PayContext *pc)
                            &pc->hc->instance->merchant_priv,
                            &sig);
   /* Build the response */
+  pos_confirmation = (NULL == pc->pos_key)
+    ? NULL
+    : TALER_build_pos_confirmation (pc->pos_key,
+                                    pc->pos_alg,
+                                    &pc->total_paid,
+                                    pc->timestamp);
   resume_pay_with_response (
     pc,
     MHD_HTTP_OK,
     TALER_MHD_MAKE_JSON_PACK (
+      GNUNET_JSON_pack_allow_null (
+        GNUNET_JSON_pack_string ("pos_confirmation",
+                                 pos_confirmation)),
       GNUNET_JSON_pack_data_auto ("sig",
                                   &sig)));
+  GNUNET_free (pos_confirmation);
 }
 
 
@@ -2563,7 +2585,7 @@ check_contract (struct PayContext *pc)
                                       &pc->contract_terms,
                                       &pc->order_serial,
                                       &paid,
-                                      NULL);
+                                      NULL); // FIXME: add &pc->pos_key + 
&pc->pos_alg!
   if (0 > qs)
   {
     /* single, read-only SQL statements should never cause

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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