[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] branch master updated: finishing with /ref
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] branch master updated: finishing with /refund handlers |
Date: |
Mon, 19 Jun 2017 16:09:41 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 99307c1 finishing with /refund handlers
99307c1 is described below
commit 99307c1e59583261947c8eee137c8c8bcf36e28d
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Jun 19 16:09:44 2017 +0200
finishing with /refund handlers
---
src/backend/taler-merchant-httpd_refund.c | 2 +-
src/lib/merchant_api_refund.c | 42 ++++++++++++++++++++++++++++---
2 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_refund.c
b/src/backend/taler-merchant-httpd_refund.c
index f690c5e..e731cf5 100644
--- a/src/backend/taler-merchant-httpd_refund.c
+++ b/src/backend/taler-merchant-httpd_refund.c
@@ -227,7 +227,7 @@ MH_handler_refund_increase (struct TMH_RequestHandler *rh,
}
/**
- * FIXME: return to the frontend. The frontend will then return
+ * Return to the frontend at this point. The frontend will then return
* a "402 Payment required" carrying a "X-Taler-Refund-Url: www"
* where 'www' is the URL where the wallet can automatically fetch
* the refund permission.
diff --git a/src/lib/merchant_api_refund.c b/src/lib/merchant_api_refund.c
index b93f2cf..7b76dac 100644
--- a/src/lib/merchant_api_refund.c
+++ b/src/lib/merchant_api_refund.c
@@ -118,7 +118,9 @@ handle_refund_increase_finished (void *cls,
{
case 0:
/* Hard error */
- break;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Backend didn't even return from POST /refund\n");
+ return;
case MHD_HTTP_OK:
rio->cb (rio->cb_cls,
MHD_HTTP_OK,
@@ -239,10 +241,42 @@ handle_refund_lookup_finished (void *cls,
long response_code,
const json_t *json)
{
- /**
- * TBD
- */
+ struct TALER_MERCHANT_RefundLookupOperation *rlo = cls;
+ char *error;
+ char *hint;
+ enum TALER_ErrorCode code;
+ rlo->job = NULL;
+ switch (response_code)
+ {
+ case 0:
+ /* Hard error */
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Backend didn't even return from GET /refund\n");
+ return;
+ case MHD_HTTP_OK:
+ rlo->cb (rlo->cb_cls,
+ MHD_HTTP_OK,
+ TALER_EC_NONE,
+ json);
+ break;
+ default:
+ /**
+ * The backend gave response, but it's error, log it.
+ * NOTE that json must be a Taler-specific error object (FIXME,
+ * need a link to error objects at docs)
+ */
+ json_unpack ((json_t *) json,
+ "{s:s, s:I, s:s}",
+ "error", &error,
+ "code", &code,
+ "hint", &hint);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed GET /refund, error: %s, code: %d, hint: %s\n",
+ error,
+ code,
+ hint);
+ }
}
/**
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-merchant] branch master updated: finishing with /refund handlers,
gnunet <=