commit 6f0813ade5c844c30314047781ac8348da9467c3
parent 46dccc5558e828a2c8e4b03ed418832843ebd3a5
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date: Mon, 19 Jun 2017 15:40:05 +0200
handler for /GET refund
Diffstat:
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/lib/merchant_api_refund.c b/src/lib/merchant_api_refund.c
@@ -108,7 +108,40 @@ handle_refund_increase_finished (void *cls,
long response_code,
const json_t *json)
{
- /* TBD */
+ struct TALER_MERCHANT_RefundIncreaseOperation *rio = cls;
+ char *error;
+ char *hint;
+ enum TALER_ErrorCode code;
+
+ rio->job = NULL;
+ switch (response_code)
+ {
+ case 0:
+ /* Hard error */
+ break;
+ case MHD_HTTP_OK:
+ rio->cb (rio->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 POST /refund, error: %s, code: %d, hint: %s\n",
+ error,
+ code,
+ hint);
+ }
}
/**