From 0dc0310cf629dc6addd293d1123d6573559b8593 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 14 Jun 2020 17:41:35 +0200 Subject: allow refund_delay to be specified with POST /orders, fix FTBFS --- src/lib/merchant_api_post_orders.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/lib') diff --git a/src/lib/merchant_api_post_orders.c b/src/lib/merchant_api_post_orders.c index 7c4d513c..73815fdf 100644 --- a/src/lib/merchant_api_post_orders.c +++ b/src/lib/merchant_api_post_orders.c @@ -173,6 +173,8 @@ handle_post_order_finished (void *cls, * @param backend_url URL of the backend * @param order basic information about this purchase, * to be extended by the backend + * @param refund_delay how long can refunds happen for this order; 0 to use + * absolute value from contract (or not allow refunds). * @param cb the callback to call when a reply * for this request is available * @param cb_cls closure for @a proposal_cb @@ -182,12 +184,14 @@ struct TALER_MERCHANT_PostOrdersOperation * TALER_MERCHANT_orders_post (struct GNUNET_CURL_Context *ctx, const char *backend_url, const json_t *order, + struct GNUNET_TIME_Relative refund_delay, TALER_MERCHANT_PostOrdersCallback cb, void *cb_cls) { return TALER_MERCHANT_orders_post2 (ctx, backend_url, order, + refund_delay, NULL, 0, NULL, @@ -205,6 +209,8 @@ TALER_MERCHANT_orders_post (struct GNUNET_CURL_Context *ctx, * @param ctx execution context * @param backend_url URL of the backend * @param order basic information about this purchase, to be extended by the backend + * @param refund_delay how long can refunds happen for this order; 0 to use + * absolute value from contract (or not allow refunds). * @param payment_target desired payment target identifier (to select merchant bank details) * @param inventory_products_length length of the @a inventory_products array * @param inventory_products products to add to the order from the inventory @@ -219,6 +225,7 @@ TALER_MERCHANT_orders_post2 ( struct GNUNET_CURL_Context *ctx, const char *backend_url, const json_t *order, + struct GNUNET_TIME_Relative refund_delay, const char *payment_target, unsigned int inventory_products_length, const struct TALER_MERCHANT_InventoryProduct inventory_products[], @@ -230,13 +237,20 @@ TALER_MERCHANT_orders_post2 ( struct TALER_MERCHANT_PostOrdersOperation *po; json_t *req; CURL *eh; + const char *delay_s; + delay_s = GNUNET_STRINGS_relative_time_to_string (refund_delay, + GNUNET_NO); po = GNUNET_new (struct TALER_MERCHANT_PostOrdersOperation); po->ctx = ctx; po->cb = cb; po->cb_cls = cb_cls; po->url = TALER_url_join (backend_url, "private/orders", + "refund_delay", + (0 != refund_delay.rel_value_us) + ? delay_s + : NULL, NULL); req = json_pack ("{s:O}", "order", (json_t *) order); -- cgit v1.2.3