From 380a5e1a76b6d0e3e269c1fd44e6f4886554626f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 6 Apr 2020 19:52:18 +0200 Subject: adapt to merchant API changes --- src/main.c | 50 ++++++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/src/main.c b/src/main.c index e43881d..a80bda5 100644 --- a/src/main.c +++ b/src/main.c @@ -1372,8 +1372,7 @@ start_read_keyboard (void); * @brief Callback to process a GET /check-payment request * * @param cls closure - * @param http_status HTTP status code for this request - * @param obj raw response body + * @param hr HTTP response * @param paid #GNUNET_YES if the payment is settled, #GNUNET_NO if not * settled, #GNUNET_SYSERR on error * (note that refunded payments are returned as paid!) @@ -1386,8 +1385,7 @@ start_read_keyboard (void); */ static void check_payment_cb (void *cls, - unsigned int http_status, - const json_t *obj, + const struct TALER_MERCHANT_HttpResponse *hr, int paid, int refunded, struct TALER_Amount *refund_amount, @@ -1397,14 +1395,14 @@ check_payment_cb (void *cls, (void) refunded; (void) refund_amount; - (void) obj; GNUNET_assert (payment_activity == pa); pa->cpo = NULL; - if (MHD_HTTP_OK != http_status) + if (MHD_HTTP_OK != hr->http_status) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Backend request to /check-payment failed: %u\n", - http_status); + "Backend request to /check-payment failed: %u/%d\n", + hr->http_status, + (int) hr->ec); mdb.cmd = &cmd_reader_display_backend_not_reachable; run_mdb_event_loop (); cleanup_payment (pa); @@ -1485,29 +1483,26 @@ check_payment_again (void *cls) * @brief Callback for a PUT /order request * * @param cls closure - * @param http_status HTTP status code for this request - * @param ec Taler error code - * @param obj raw response body + * @param hr HTTP response for this request * @param order_id order ID of the order created */ static void proposal_cb (void *cls, - unsigned int http_status, - enum TALER_ErrorCode ec, - const json_t *obj, + const struct TALER_MERCHANT_HttpResponse *hr, const char *order_id) { - (void) obj; struct PaymentActivity *pa = cls; pa->po = NULL; - if (MHD_HTTP_OK != http_status) + if (MHD_HTTP_OK != hr->http_status) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to setup order with backend: %u/%d\n", - http_status, - (int) ec); - json_dumpf (obj, stderr, 0); + hr->http_status, + (int) hr->ec); + json_dumpf (hr->reply, + stderr, + 0); mdb.cmd = &cmd_reader_display_backend_not_reachable; run_mdb_event_loop (); cleanup_payment (pa); @@ -1647,26 +1642,21 @@ vend_success () * @brief Callback to process a POST /refund request * * @param cls closure - * @param http_status HTTP status code for this request - * @param ec taler-specific error code - * @param obj the response body + * @param hr HTTP response details */ static void refund_complete_cb (void *cls, - unsigned int http_status, - enum TALER_ErrorCode ec, - const json_t *obj) + const struct TALER_MERCHANT_HttpResponse *hr) { struct Refund *r = cls; - (void) obj; r->rio = NULL; - if (MHD_HTTP_OK != http_status) + if (MHD_HTTP_OK != hr->http_status) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to grant consumer refund: %u/%d\n", - http_status, - ec); + hr->http_status, + (int) hr->ec); } GNUNET_CONTAINER_DLL_remove (refund_head, refund_tail, @@ -1679,7 +1669,7 @@ refund_complete_cb (void *cls, * @brief Vending failed, provide refund. */ static void -vend_failure () +vend_failure (void) { struct Product *p; struct Refund *r; -- cgit v1.2.3