gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] 19/24: finish merchant client api /kyc implementation


From: gnunet
Subject: [taler-merchant] 19/24: finish merchant client api /kyc implementation
Date: Wed, 17 Nov 2021 12:44:42 +0100

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

grothoff pushed a commit to branch master
in repository merchant.

commit e2cc5c269ad12c3407886f5030862ef5a26840ba
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Nov 7 13:58:01 2021 +0100

    finish merchant client api /kyc implementation
---
 src/lib/merchant_api_get_kyc.c | 65 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 62 insertions(+), 3 deletions(-)

diff --git a/src/lib/merchant_api_get_kyc.c b/src/lib/merchant_api_get_kyc.c
index d793703e..8beee99b 100644
--- a/src/lib/merchant_api_get_kyc.c
+++ b/src/lib/merchant_api_get_kyc.c
@@ -78,9 +78,68 @@ parse_kyc (struct TALER_MERCHANT_KycGetHandle *kyc,
            json_t *pends,
            json_t *touts)
 {
-  // FIXME...
-  GNUNET_break (0);
-  return GNUNET_SYSERR;
+  unsigned int num_pends = json_array_size (pends);
+  unsigned int num_touts = json_array_size (touts);
+  struct TALER_MERCHANT_AccountKycRedirectDetail pending_kycs[GNUNET_NZL (
+                                                                num_pends)];
+  struct TALER_MERCHANT_ExchangeKycFailureDetail timeout_kycs[GNUNET_NZL (
+                                                                num_touts)];
+
+  for (unsigned int i = 0; i<num_pends; i++)
+  {
+    struct GNUNET_JSON_Specification spec[] = {
+      GNUNET_JSON_spec_string ("kyc_url",
+                               &pending_kycs[i].kyc_url),
+      GNUNET_JSON_spec_string ("exchange_url",
+                               &pending_kycs[i].exchange_url),
+      GNUNET_JSON_spec_string ("payto_uri",
+                               &pending_kycs[i].payto_uri),
+      GNUNET_JSON_spec_end ()
+    };
+
+    if (GNUNET_OK !=
+        GNUNET_JSON_parse (json_array_get (pends,
+                                           i),
+                           spec,
+                           NULL, NULL))
+    {
+      GNUNET_break (0);
+      return GNUNET_SYSERR;
+    }
+  }
+  for (unsigned int i = 0; i<num_touts; i++)
+  {
+    uint32_t hs;
+    uint32_t ec;
+    struct GNUNET_JSON_Specification spec[] = {
+      GNUNET_JSON_spec_string ("exchange_url",
+                               &timeout_kycs[i].exchange_url),
+      GNUNET_JSON_spec_uint32 ("exchange_code",
+                               &ec),
+      GNUNET_JSON_spec_uint32 ("exchange_http_status",
+                               &hs),
+      GNUNET_JSON_spec_end ()
+    };
+
+    if (GNUNET_OK !=
+        GNUNET_JSON_parse (json_array_get (touts,
+                                           i),
+                           spec,
+                           NULL, NULL))
+    {
+      GNUNET_break (0);
+      return GNUNET_SYSERR;
+    }
+    timeout_kycs[i].exchange_http_status = (unsigned int) hs;
+    timeout_kycs[i].exchange_code = (enum TALER_ErrorCode) ec;
+  }
+  kr->details.kyc_status.pending_kycs = pending_kycs;
+  kr->details.kyc_status.timeout_kycs = timeout_kycs;
+  kr->details.kyc_status.pending_kycs_length = num_pends;
+  kr->details.kyc_status.timeout_kycs_length = num_touts;
+  kyc->cb (kyc->cb_cls,
+           kr);
+  return GNUNET_OK;
 }
 
 

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