summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-10-30 16:59:57 +0100
committerChristian Grothoff <christian@grothoff.org>2020-10-30 16:59:57 +0100
commitc0e3270e1499a525cd2cc7d21d31c26bdb0e705c (patch)
treec695673a13e8cd2bdc650c537b77b0f94ae725d7
parentd1491107791a1e123d977891682c47490d9fe3cc (diff)
downloadsync-c0e3270e1499a525cd2cc7d21d31c26bdb0e705c.tar.gz
sync-c0e3270e1499a525cd2cc7d21d31c26bdb0e705c.tar.bz2
sync-c0e3270e1499a525cd2cc7d21d31c26bdb0e705c.zip
update to match merchant API change
-rw-r--r--src/sync/sync-httpd_backup_post.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/sync/sync-httpd_backup_post.c b/src/sync/sync-httpd_backup_post.c
index a6c4362..23872e5 100644
--- a/src/sync/sync-httpd_backup_post.c
+++ b/src/sync/sync-httpd_backup_post.c
@@ -109,6 +109,7 @@ struct BackupContext
/**
* HTTP response code to use on resume, if non-NULL.
+
*/
struct MHD_Response *resp;
@@ -305,35 +306,30 @@ make_payment_request (const char *order_id,
* /contract request to a merchant.
*
* @param cls our `struct BackupContext`
- * @param hr HTTP response details
- * @param order_id order id of the newly created order
- * @param token the claim token generated by the merchant (NULL if
- * it wasn't generated).
+ * @param por response details
*/
static void
proposal_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const char *order_id,
- const struct TALER_ClaimTokenP *token)
+ const struct TALER_MERCHANT_PostOrdersReply *por)
{
struct BackupContext *bc = cls;
enum SYNC_DB_QueryStatus qs;
bc->po = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Resuming connection with order `%s'\n",
- order_id);
GNUNET_CONTAINER_DLL_remove (bc_head,
bc_tail,
bc);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Resuming connection with order `%s'\n",
+ bc->order_id);
MHD_resume_connection (bc->con);
SH_trigger_daemon ();
- if (MHD_HTTP_OK != hr->http_status)
+ if (MHD_HTTP_OK != por->hr.http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Backend returned status %u/%u\n",
- hr->http_status,
- (unsigned int) hr->ec);
+ por->hr.http_status,
+ (unsigned int) por->hr.ec);
GNUNET_break (0);
bc->resp = TALER_MHD_make_json_pack ("{s:I, s:s, s:I, s:I, s:O}",
"code",
@@ -342,22 +338,22 @@ proposal_cb (void *cls,
"hint",
"Failed to setup order with merchant backend",
"backend-ec",
- (json_int_t) hr->ec,
+ (json_int_t) por->hr.ec,
"backend-http-status",
- (json_int_t) hr->http_status,
+ (json_int_t) por->hr.http_status,
"backend-reply",
- hr->reply);
+ por->hr.reply);
GNUNET_assert (NULL != bc->resp);
bc->response_code = MHD_HTTP_FAILED_DEPENDENCY;
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Storing payment request for order `%s'\n",
- order_id);
+ por->details.ok.order_id);
qs = db->store_payment_TR (db->cls,
&bc->account,
- order_id,
- token,
+ por->details.ok.order_id,
+ por->details.ok.token,
&SH_annual_fee);
if (0 >= qs)
{
@@ -370,9 +366,9 @@ proposal_cb (void *cls,
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Obtained fresh order `%s'\n",
- order_id);
- bc->resp = make_payment_request (order_id,
- token);
+ por->details.ok.order_id);
+ bc->resp = make_payment_request (por->details.ok.order_id,
+ por->details.ok.token);
GNUNET_assert (NULL != bc->resp);
bc->response_code = MHD_HTTP_PAYMENT_REQUIRED;
}