gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: address bank_api_credit comment/


From: gnunet
Subject: [taler-exchange] branch master updated: address bank_api_credit comment/FIXME from Florian, also adapt debit logic accordingly
Date: Sun, 26 Jan 2020 17:48:16 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 282e4f59 address bank_api_credit comment/FIXME from Florian, also 
adapt debit logic accordingly
282e4f59 is described below

commit 282e4f59ee849c6c84f753e8fae5691aaf8e9303
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Jan 26 17:48:13 2020 +0100

    address bank_api_credit comment/FIXME from Florian, also adapt debit logic 
accordingly
---
 src/bank-lib/bank_api_credit.c | 23 +++++++----------------
 src/bank-lib/bank_api_debit.c  | 30 ++++++++++++++----------------
 2 files changed, 21 insertions(+), 32 deletions(-)

diff --git a/src/bank-lib/bank_api_credit.c b/src/bank-lib/bank_api_credit.c
index 50725a4e..66e128da 100644
--- a/src/bank-lib/bank_api_credit.c
+++ b/src/bank-lib/bank_api_credit.c
@@ -30,7 +30,7 @@
 
 
 /**
- * @brief A /history Handle
+ * @brief A /history/incoming Handle
  */
 struct TALER_BANK_CreditHistoryHandle
 {
@@ -173,30 +173,21 @@ handle_credit_history_finished (void *cls,
     GNUNET_break_op (0);
     ec = TALER_JSON_get_error_code (j);
     break;
-  case MHD_HTTP_FORBIDDEN:
-    /* Access denied */
-    GNUNET_break_op (0);
-    ec = TALER_JSON_get_error_code (j);
-    break;
   case MHD_HTTP_UNAUTHORIZED:
-    /* FIXME(dold): I don't get this comment below.  What signatures would the
-       bank even verify?! */
-    /* Nothing really to verify, bank says one of the signatures is
-       invalid; as we checked them, this should never happen, we
-       should pass the JSON reply to the application */
-    GNUNET_break_op (0);
+    /* Nothing really to verify, bank says the HTTP Authentication
+       failed. May happen if HTTP authentication is used and the
+       user supplied a wrong username/password combination. */
     ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_NOT_FOUND:
-    /* Nothing really to verify, this should never
-       happen, we should pass the JSON reply to the application */
-    GNUNET_break_op (0);
+    /* Nothing really to verify: the bank is either unaware
+       of the endpoint (not a bank), or of the account.
+       We should pass the JSON (?) reply to the application */
     ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_INTERNAL_SERVER_ERROR:
     /* Server had an internal issue; we should retry, but this API
        leaves this to the application */
-    GNUNET_break_op (0);
     ec = TALER_JSON_get_error_code (j);
     break;
   default:
diff --git a/src/bank-lib/bank_api_debit.c b/src/bank-lib/bank_api_debit.c
index 0e218eb4..58f6ae6d 100644
--- a/src/bank-lib/bank_api_debit.c
+++ b/src/bank-lib/bank_api_debit.c
@@ -30,7 +30,7 @@
 
 
 /**
- * @brief A /history Handle
+ * @brief A /history/outgoing Handle
  */
 struct TALER_BANK_DebitHistoryHandle
 {
@@ -129,16 +129,16 @@ parse_account_history (struct 
TALER_BANK_DebitHistoryHandle *hh,
 
 /**
  * Function called when we're done processing the
- * HTTP /history request.
+ * HTTP /history/outgoing request.
  *
  * @param cls the `struct TALER_BANK_DebitHistoryHandle`
  * @param response_code HTTP response code, 0 on error
  * @param response parsed JSON result, NULL on error
  */
 static void
-handle_history_finished (void *cls,
-                         long response_code,
-                         const void *response)
+handle_debit_history_finished (void *cls,
+                               long response_code,
+                               const void *response)
 {
   struct TALER_BANK_DebitHistoryHandle *hh = cls;
   enum TALER_ErrorCode ec;
@@ -169,21 +169,19 @@ handle_history_finished (void *cls,
   case MHD_HTTP_BAD_REQUEST:
     /* This should never happen, either us or the bank is buggy
        (or API version conflict); just pass JSON reply to the application */
-    ec = TALER_JSON_get_error_code (j);
-    break;
-  case MHD_HTTP_FORBIDDEN:
-    /* Access denied */
+    GNUNET_break_op (0);
     ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_UNAUTHORIZED:
-    /* Nothing really to verify, bank says one of the signatures is
-       invalid; as we checked them, this should never happen, we
-       should pass the JSON reply to the application */
+    /* Nothing really to verify, bank says the HTTP Authentication
+       failed. May happen if HTTP authentication is used and the
+       user supplied a wrong username/password combination. */
     ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_NOT_FOUND:
-    /* Nothing really to verify, this should never
-       happen, we should pass the JSON reply to the application */
+    /* Nothing really to verify: the bank is either unaware
+       of the endpoint (not a bank), or of the account.
+       We should pass the JSON (?) reply to the application */
     ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_INTERNAL_SERVER_ERROR:
@@ -196,7 +194,7 @@ handle_history_finished (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Unexpected response code %u\n",
                 (unsigned int) response_code);
-    GNUNET_break (0);
+    GNUNET_break_op (0);
     ec = TALER_JSON_get_error_code (j);
     response_code = 0;
     break;
@@ -292,7 +290,7 @@ TALER_BANK_debit_history (struct GNUNET_CURL_Context *ctx,
   hh->job = GNUNET_CURL_job_add2 (ctx,
                                   eh,
                                   NULL,
-                                  &handle_history_finished,
+                                  &handle_debit_history_finished,
                                   hh);
   return hh;
 }

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



reply via email to

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