diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-06-14 17:41:35 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-06-14 17:41:35 +0200 |
commit | 0dc0310cf629dc6addd293d1123d6573559b8593 (patch) | |
tree | fde168a9eb4860331782c23b6550661f321f139b /src/lib | |
parent | 8716f80c3ad14e5bd8a7af0b424e480aafa18c57 (diff) | |
download | merchant-0dc0310cf629dc6addd293d1123d6573559b8593.tar.gz merchant-0dc0310cf629dc6addd293d1123d6573559b8593.tar.bz2 merchant-0dc0310cf629dc6addd293d1123d6573559b8593.zip |
allow refund_delay to be specified with POST /orders, fix FTBFS
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/merchant_api_post_orders.c | 14 |
1 files changed, 14 insertions, 0 deletions
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); |