summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-06 19:52:18 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-06 19:52:18 +0200
commit380a5e1a76b6d0e3e269c1fd44e6f4886554626f (patch)
tree12bd175624cbb6925681a81bf48ff2f4bd93235a
parentb172b5c530e7d0e16370b6a4fd66108e06b750ac (diff)
downloadtaler-mdb-380a5e1a76b6d0e3e269c1fd44e6f4886554626f.tar.gz
taler-mdb-380a5e1a76b6d0e3e269c1fd44e6f4886554626f.tar.bz2
taler-mdb-380a5e1a76b6d0e3e269c1fd44e6f4886554626f.zip
adapt to merchant API changes
-rw-r--r--src/main.c50
1 files 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;