[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 218/277: allow refund_delay to be specified with POST /
From: |
gnunet |
Subject: |
[taler-merchant] 218/277: allow refund_delay to be specified with POST /orders, fix FTBFS |
Date: |
Sun, 05 Jul 2020 20:52:11 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit 0dc0310cf629dc6addd293d1123d6573559b8593
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jun 14 17:41:35 2020 +0200
allow refund_delay to be specified with POST /orders, fix FTBFS
---
src/include/taler_merchant_service.h | 6 ++++++
src/lib/merchant_api_post_orders.c | 14 ++++++++++++++
src/testing/testing_api_cmd_get_transfers.c | 2 +-
src/testing/testing_api_cmd_post_orders.c | 1 +
4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/include/taler_merchant_service.h
b/src/include/taler_merchant_service.h
index 62e6224..740c213 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 7c4d513..73815fd 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 59ff2a0..634a0ed 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 d8bf23f..8bdd786 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);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] 198/277: enable handler, (continued)
- [taler-merchant] 198/277: enable handler, gnunet, 2020/07/05
- [taler-merchant] 200/277: test with MHD error, gnunet, 2020/07/05
- [taler-merchant] 201/277: fix crash, gnunet, 2020/07/05
- [taler-merchant] 205/277: fixed authorize tip and tests for GET /private/tips, gnunet, 2020/07/05
- [taler-merchant] 203/277: sync, gnunet, 2020/07/05
- [taler-merchant] 188/277: private-get-orders-ID now compiles -- but not more than that, gnunet, 2020/07/05
- [taler-merchant] 208/277: implement missing SQL, gnunet, 2020/07/05
- [taler-merchant] 211/277: adjust API to current spec, gnunet, 2020/07/05
- [taler-merchant] 215/277: this was done by Jonathan, gnunet, 2020/07/05
- [taler-merchant] 213/277: starting with merchant_api_merchant_get_order.c, gnunet, 2020/07/05
- [taler-merchant] 218/277: allow refund_delay to be specified with POST /orders, fix FTBFS,
gnunet <=
- [taler-merchant] 216/277: clean up logic: use new EXCHANGE_YNA enum, avoid crazy macro construction to build URLs, use full power of TALER_url_join() instead, gnunet, 2020/07/05
- [taler-merchant] 219/277: tests for new db methods, gnunet, 2020/07/05
- [taler-merchant] 204/277: moved yna to exchange, gnunet, 2020/07/05
- [taler-merchant] 214/277: add logic to parse refund details, gnunet, 2020/07/05
- [taler-merchant] 212/277: adjust GET /orders/ID to match spec, gnunet, 2020/07/05
- [taler-merchant] 217/277: implement merchant_api_merchant_get_order.c, gnunet, 2020/07/05
- [taler-merchant] 221/277: test for GET /private/reserves/, gnunet, 2020/07/05
- [taler-merchant] 224/277: stricter tests for tips/reserves, gnunet, 2020/07/05
- [taler-merchant] 223/277: implementations, tests, and renames for GET /tips/ & GET /private/tips/, gnunet, 2020/07/05
- [taler-merchant] 226/277: naive tests for the family of GET order(s) methods, gnunet, 2020/07/05