gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated (dccb300b -> 1b89e838)


From: gnunet
Subject: [taler-exchange] branch master updated (dccb300b -> 1b89e838)
Date: Fri, 10 Apr 2020 16:49:57 +0200

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

grothoff pushed a change to branch master
in repository exchange.

    from dccb300b enforce proper URL limit (#6172)
     new e59e9220 fix check for twister
     new 70a794b6 add error codes
     new 1b89e838 return signature from refund API

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 configure.ac                         | 21 ++++++++++-----------
 src/include/taler_error_codes.h      | 13 +++++++++++++
 src/include/taler_exchange_service.h | 19 +++++++++++--------
 src/lib/exchange_api_refund.c        | 19 +++++++++++++------
 src/testing/testing_api_cmd_refund.c |  4 +++-
 5 files changed, 50 insertions(+), 26 deletions(-)

diff --git a/configure.ac b/configure.ac
index 51a4646d..ac0a058d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -329,10 +329,10 @@ LDFLAGS=$LDFLAGS_SAVE
 LIBS=$LIBS_SAVE
 
 # check for libtalertwistertesting
-twistertesting=0
-AC_MSG_CHECKING([for talerwtistertesting])
+talertwister=0
+AC_MSG_CHECKING([for talertwister])
 AC_ARG_WITH([twister],
-            [AS_HELP_STRING([--with-twister=PFX], [base of 
libtalertwistertesting])],
+            [AS_HELP_STRING([--with-twister=PFX], [base of libtalertwister])],
             [AC_MSG_RESULT([given as $with_twister])],
             [AC_MSG_RESULT([not given])
              with_twister=yes])
@@ -341,14 +341,13 @@ AS_CASE([$with_twister],
         [no], [AC_MSG_WARN([no twister-testing will be compiled])],
         [LDFLAGS="-L$with_twister/lib $LDFLAGS"
          CPPFLAGS="-I$with_twister/include $CPPFLAGS"])
-AC_CHECK_LIB(talertwistertesting,TALER_TESTING_run_twister,
-  [AC_CHECK_HEADER([taler/taler_twister_testing_lib.h],[twistertesting=1],,
-                   [#ifdef HAVE_GNUNET_PLATFORM_H
-                      #include <gnunet/platform.h>
-                    #endif
-                    ])])
-
-AM_CONDITIONAL(HAVE_TWISTER, test x$twistertesting = x1)
+
+AC_CHECK_HEADERS([taler/taler_twister_service.h],
+ [AC_CHECK_LIB([talertwister], [TALER_TWISTER_connect], talertwister=1)],
+   [], [#ifdef HAVE_GNUNET_PLATFORM_H
+        #include <gnunet/platform.h>
+       #endif])
+AM_CONDITIONAL(HAVE_TWISTER, test x$talertwister = x1)
 
 # should developer logic be compiled (not-for-production code)?
 AC_MSG_CHECKING(whether to compile developer logic)
diff --git a/src/include/taler_error_codes.h b/src/include/taler_error_codes.h
index 44c29ca7..cff88857 100644
--- a/src/include/taler_error_codes.h
+++ b/src/include/taler_error_codes.h
@@ -1603,6 +1603,12 @@ enum TALER_ErrorCode
    */
   TALER_EC_PROPOSAL_REPLY_MALFORMED = 2510,
 
+  /**
+   * The merchant returned a malformed response. Error created client-
+   * side.
+   */
+  TALER_EC_REFUND_LOOKUP_INVALID_RESPONSE = 2600,
+
   /**
    * The frontend gave an unknown order id to issue the refund to.
    */
@@ -1642,6 +1648,13 @@ enum TALER_ErrorCode
    */
   TALER_EC_PAY_REFUND_SIGNATURE_FAILED = 2606,
 
+  /**
+   * The merchant backend is not available of any applicable refund(s)
+   * for this order. Returned with an HTTP status of
+   * #MHD_HTTP_NOT_FOUND.
+   */
+  TALER_EC_REFUND_LOOKUP_NO_REFUND = 2607,
+
   /**
    * The backend knows the instance that was supposed to support the
    * tip, but it was not configured for tipping (i.e. has no exchange
diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index 68f0cea3..de7cb1e2 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -850,22 +850,23 @@ struct TALER_EXCHANGE_RefundHandle;
  * @param cls closure
  * @param hr HTTP response data
  * @param sign_key exchange key used to sign @a obj, or NULL
+ * @param signature the actual signature, or NULL on error
  */
 typedef void
 (*TALER_EXCHANGE_RefundCallback) (
   void *cls,
   const struct TALER_EXCHANGE_HttpResponse *hr,
-  const struct TALER_ExchangePublicKeyP *sign_key);
+  const struct TALER_ExchangePublicKeyP *sign_key,
+  const struct TALER_ExchangeSignatureP *signature);
 
 
 /**
- * Submit a refund request to the exchange and get the exchange's
- * response.  This API is used by a merchant.  Note that
- * while we return the response verbatim to the caller for further
- * processing, we do already verify that the response is well-formed
- * (i.e. that signatures included in the response are all valid).  If
- * the exchange's reply is not well-formed, we return an HTTP status code
- * of zero to @a cb.
+ * Submit a refund request to the exchange and get the exchange's response.
+ * This API is used by a merchant.  Note that while we return the response
+ * verbatim to the caller for further processing, we do already verify that
+ * the response is well-formed (i.e. that signatures included in the response
+ * are all valid).  If the exchange's reply is not well-formed, we return an
+ * HTTP status code of zero to @a cb.
  *
  * The @a exchange must be ready to operate (i.e.  have
  * finished processing the /keys reply).  If this check fails, we do
@@ -913,6 +914,8 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle 
*exchange,
  * finished processing the /keys reply).  If this check fails, we do
  * NOT initiate the transaction with the exchange and instead return NULL.
  *
+ * FIXME: We can probably DEPRECATE this API and only use 
#TALER_EXCHANGE_refund()!
+ *
  * @param exchange the exchange handle; the exchange must be ready to operate
  * @param amount the amount to be refunded; must be larger than the refund fee
  *        (as that fee is still being subtracted), and smaller than the amount
diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c
index 7ece7eb1..c64dcc97 100644
--- a/src/lib/exchange_api_refund.c
+++ b/src/lib/exchange_api_refund.c
@@ -84,17 +84,19 @@ struct TALER_EXCHANGE_RefundHandle
  * @param rh refund handle
  * @param json json reply with the signature
  * @param[out] exchange_pub set to the exchange's public key
+ * @param[out] exchange_sig set to the exchange's signature
  * @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not
  */
 static int
 verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh,
                             const json_t *json,
-                            struct TALER_ExchangePublicKeyP *exchange_pub)
+                            struct TALER_ExchangePublicKeyP *exchange_pub,
+                            struct TALER_ExchangeSignatureP *exchange_sig)
+
 {
-  struct TALER_ExchangeSignatureP exchange_sig;
   const struct TALER_EXCHANGE_Keys *key_state;
   struct GNUNET_JSON_Specification spec[] = {
-    GNUNET_JSON_spec_fixed_auto ("sig", &exchange_sig),
+    GNUNET_JSON_spec_fixed_auto ("sig", exchange_sig),
     GNUNET_JSON_spec_fixed_auto ("pub", exchange_pub),
     GNUNET_JSON_spec_end ()
   };
@@ -118,7 +120,7 @@ verify_refund_signature_ok (const struct 
TALER_EXCHANGE_RefundHandle *rh,
   if (GNUNET_OK !=
       GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND,
                                   &rh->depconf,
-                                  &exchange_sig.eddsa_signature,
+                                  &exchange_sig->eddsa_signature,
                                   &exchange_pub->eddsa_pub))
   {
     GNUNET_break_op (0);
@@ -143,7 +145,9 @@ handle_refund_finished (void *cls,
 {
   struct TALER_EXCHANGE_RefundHandle *rh = cls;
   struct TALER_ExchangePublicKeyP exchange_pub;
+  struct TALER_ExchangeSignatureP exchange_sig;
   struct TALER_ExchangePublicKeyP *ep = NULL;
+  struct TALER_ExchangeSignatureP *es = NULL;
   const json_t *j = response;
   struct TALER_EXCHANGE_HttpResponse hr = {
     .reply = j,
@@ -160,7 +164,8 @@ handle_refund_finished (void *cls,
     if (GNUNET_OK !=
         verify_refund_signature_ok (rh,
                                     j,
-                                    &exchange_pub))
+                                    &exchange_pub,
+                                    &exchange_sig))
     {
       GNUNET_break_op (0);
       hr.http_status = 0;
@@ -169,6 +174,7 @@ handle_refund_finished (void *cls,
     else
     {
       ep = &exchange_pub;
+      es = &exchange_sig;
     }
     break;
   case MHD_HTTP_BAD_REQUEST:
@@ -227,7 +233,8 @@ handle_refund_finished (void *cls,
   }
   rh->cb (rh->cb_cls,
           &hr,
-          ep);
+          ep,
+          es);
   TALER_EXCHANGE_refund_cancel (rh);
 }
 
diff --git a/src/testing/testing_api_cmd_refund.c 
b/src/testing/testing_api_cmd_refund.c
index 7dbcc341..47f5a060 100644
--- a/src/testing/testing_api_cmd_refund.c
+++ b/src/testing/testing_api_cmd_refund.c
@@ -83,11 +83,13 @@ struct RefundState
  * @param hr HTTP response details
  * @param exchange_pub public key the exchange
  *        used for signing @a obj.
+ * @param exchange_sig actual signature confirming the refund
  */
 static void
 refund_cb (void *cls,
            const struct TALER_EXCHANGE_HttpResponse *hr,
-           const struct TALER_ExchangePublicKeyP *exchange_pub)
+           const struct TALER_ExchangePublicKeyP *exchange_pub,
+           const struct TALER_ExchangeSignatureP *exchange_sig)
 {
 
   struct RefundState *rs = cls;

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



reply via email to

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