gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: add KYC handling to get-orders h


From: gnunet
Subject: [taler-merchant] branch master updated: add KYC handling to get-orders handler
Date: Wed, 20 Oct 2021 18:35:20 +0200

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 14c5d00e add KYC handling to get-orders handler
14c5d00e is described below

commit 14c5d00ebd98fdb299fa16c9721588d55f8d3b35
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Oct 20 18:35:18 2021 +0200

    add KYC handling to get-orders handler
---
 .../taler-merchant-httpd_private-get-orders-ID.c   | 63 +++++++++++++++++++---
 1 file changed, 57 insertions(+), 6 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
index a981a7cf..c2fe759f 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -60,6 +60,11 @@ struct TransferQuery
    */
   struct TransferQuery *prev;
 
+  /**
+   * Base URL of the exchange.
+   */
+  char *exchange_url;
+
   /**
    * Handle to query exchange about deposit status.
    */
@@ -447,6 +452,7 @@ deposit_get_cb (void *cls,
                      TALER_EC_GENERIC_DB_STORE_FAILED,
                      &tq->coin_pub,
                      NULL);
+        GNUNET_free (tq->exchange_url);
         GNUNET_free (tq);
         if (NULL == gorc->tq_head)
           gorc_resume (gorc,
@@ -464,6 +470,7 @@ deposit_get_cb (void *cls,
                      
TALER_EC_MERCHANT_PRIVATE_GET_ORDERS_ID_AMOUNT_ARITHMETIC_FAILURE,
                      &tq->coin_pub,
                      NULL);
+        GNUNET_free (tq->exchange_url);
         GNUNET_free (tq);
         if (NULL == gorc->tq_head)
           gorc_resume (gorc,
@@ -480,6 +487,7 @@ deposit_get_cb (void *cls,
                      
TALER_EC_MERCHANT_PRIVATE_GET_ORDERS_ID_AMOUNT_ARITHMETIC_FAILURE,
                      &tq->coin_pub,
                      NULL);
+        GNUNET_free (tq->exchange_url);
         GNUNET_free (tq);
         if (NULL == gorc->tq_head)
           gorc_resume (gorc,
@@ -489,18 +497,56 @@ deposit_get_cb (void *cls,
       }
     }
   case MHD_HTTP_ACCEPTED:
-    /* got a 'preliminary' reply from the exchange, simply skip */
-    // FIXME: store dr->details.accepted.payment_target_uuid!
-    gorc_report (gorc,
-                 TALER_EC_NONE,
-                 &tq->coin_pub,
-                 &dr->hr);
+    {
+      /* got a 'preliminary' reply from the exchange,
+         remember our target UUID */
+      enum GNUNET_DB_QueryStatus qs;
+      struct GNUNET_TIME_Absolute now;
+      struct GNUNET_HashCode h_wire;
+
+      now = GNUNET_TIME_absolute_get ();
+      (void) GNUNET_TIME_round_abs (&now);
+      GNUNET_assert (GNUNET_OK ==
+                     TALER_JSON_merchant_wire_signature_hash (
+                       gorc->wire_details,
+                       &h_wire));
+      qs = TMH_db->account_kyc_set_status (
+        TMH_db->cls,
+        gorc->hc->instance->settings.id,
+        &h_wire,
+        tq->exchange_url,
+        dr->details.accepted.payment_target_uuid,
+        NULL,
+        NULL,
+        now,
+        false);
+      if (qs < 0)
+      {
+        gorc_report (gorc,
+                     TALER_EC_GENERIC_DB_STORE_FAILED,
+                     &tq->coin_pub,
+                     NULL);
+        GNUNET_free (tq->exchange_url);
+        GNUNET_free (tq);
+        if (NULL == gorc->tq_head)
+          gorc_resume (gorc,
+                       0,
+                       TALER_EC_NONE);
+        return;
+      }
+      gorc_report (gorc,
+                   TALER_EC_NONE,
+                   &tq->coin_pub,
+                   &dr->hr);
+      break;
+    }
   default:
     {
       gorc_report (gorc,
                    TALER_EC_MERCHANT_GET_ORDERS_EXCHANGE_TRACKING_FAILURE,
                    &tq->coin_pub,
                    &dr->hr);
+      GNUNET_free (tq->exchange_url);
       GNUNET_free (tq);
       if (NULL == gorc->tq_head)
         gorc_resume (gorc,
@@ -509,6 +555,7 @@ deposit_get_cb (void *cls,
       return;
     }
   } /* end switch */
+  GNUNET_free (tq->exchange_url);
   GNUNET_free (tq);
   if (NULL != gorc->tq_head)
     return;
@@ -548,6 +595,7 @@ exchange_found_cb (void *cls,
     GNUNET_CONTAINER_DLL_remove (gorc->tq_head,
                                  gorc->tq_tail,
                                  tq);
+    GNUNET_free (tq->exchange_url);
     GNUNET_free (tq);
     gorc_resume (gorc,
                  MHD_HTTP_GATEWAY_TIMEOUT,
@@ -560,6 +608,7 @@ exchange_found_cb (void *cls,
     GNUNET_CONTAINER_DLL_remove (gorc->tq_head,
                                  gorc->tq_tail,
                                  tq);
+    GNUNET_free (tq->exchange_url);
     GNUNET_free (tq);
     gorc->exchange_hc = hr->http_status;
     gorc->exchange_ec = hr->ec;
@@ -580,6 +629,7 @@ exchange_found_cb (void *cls,
     GNUNET_CONTAINER_DLL_remove (gorc->tq_head,
                                  gorc->tq_tail,
                                  tq);
+    GNUNET_free (tq->exchange_url);
     GNUNET_free (tq);
     gorc_resume (gorc,
                  MHD_HTTP_INTERNAL_SERVER_ERROR,
@@ -618,6 +668,7 @@ deposit_cb (void *cls,
 
   tq = GNUNET_new (struct TransferQuery);
   tq->gorc = gorc;
+  tq->exchange_url = GNUNET_strdup (exchange_url);
   tq->deposit_serial = deposit_serial;
   GNUNET_CONTAINER_DLL_insert (gorc->tq_head,
                                gorc->tq_tail,

-- 
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]