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 | |
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
-rw-r--r-- | src/include/taler_merchant_service.h | 6 | ||||
-rw-r--r-- | src/lib/merchant_api_post_orders.c | 14 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_get_transfers.c | 2 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_orders.c | 1 |
4 files changed, 22 insertions, 1 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 62e62246..740c213d 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -1129,6 +1129,8 @@ typedef void * @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 cb the callback to call when a reply for this request is available * @param cb_cls closure for @a cb * @return a handle for this request, NULL on error @@ -1137,6 +1139,7 @@ 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); @@ -1166,6 +1169,8 @@ struct TALER_MERCHANT_InventoryProduct * @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 @@ -1180,6 +1185,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[], 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); diff --git a/src/testing/testing_api_cmd_get_transfers.c b/src/testing/testing_api_cmd_get_transfers.c index 59ff2a0c..634a0ed7 100644 --- a/src/testing/testing_api_cmd_get_transfers.c +++ b/src/testing/testing_api_cmd_get_transfers.c @@ -144,7 +144,7 @@ get_transfers_run (void *cls, GNUNET_TIME_UNIT_ZERO_ABS, INT64_MAX, 0, - TALER_MERCHANT_YNA_ALL, + TALER_EXCHANGE_YNA_ALL, &get_transfers_cb, gts); GNUNET_assert (NULL != gts->gth); diff --git a/src/testing/testing_api_cmd_post_orders.c b/src/testing/testing_api_cmd_post_orders.c index d8bf23f0..8bdd7862 100644 --- a/src/testing/testing_api_cmd_post_orders.c +++ b/src/testing/testing_api_cmd_post_orders.c @@ -314,6 +314,7 @@ orders_run (void *cls, ps->po = TALER_MERCHANT_orders_post (is->ctx, ps->merchant_url, order, + GNUNET_TIME_UNIT_ZERO, &order_cb, ps); json_decref (order); |