summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-10-20 20:24:03 +0200
committerChristian Grothoff <christian@grothoff.org>2020-10-20 20:24:03 +0200
commit3a74de266c9724c6b804244e14870cd017e8a721 (patch)
tree5def2405afae3d20839e02681a42ca5c02ab31ab
parent33e80b885a9c97d85eb009027feecfba2928165f (diff)
downloadmerchant-3a74de266c9724c6b804244e14870cd017e8a721.tar.gz
merchant-3a74de266c9724c6b804244e14870cd017e8a721.tar.bz2
merchant-3a74de266c9724c6b804244e14870cd017e8a721.zip
expose refund_pending status in GET /private/orders/<ID> operation. Fixes #6491.
-rw-r--r--src/backend/taler-merchant-httpd_get-orders-ID.c3
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders-ID.c69
-rw-r--r--src/include/taler_merchant_service.h6
-rw-r--r--src/lib/merchant_api_merchant_get_order.c2
4 files changed, 48 insertions, 32 deletions
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c
index 82404f6a..5c6949bb 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -1204,8 +1204,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
"{s:b, s:b, s:o}",
"refunded", god->refunded,
"refund_pending", god->refund_available,
- "refund_amount",
- TALER_JSON_from_amount (&god->refund_amount));
+ "refund_amount", TALER_JSON_from_amount (&god->refund_amount));
}
}
}
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
index 49bd63cf..9f0b9fef 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -251,6 +251,12 @@ struct GetOrderRequestContext
bool refunded;
/**
+ * Set to true if this payment has been refunded and
+ * some refunds remain to be picked up by the wallet.
+ */
+ bool refund_pending;
+
+ /**
* Did the client request us to fetch the wire transfer status?
* If false, we may still return it if it is available.
*/
@@ -667,6 +673,7 @@ process_refunds_cb (void *cls,
&gorc->refund_amount,
refund_amount));
gorc->refunded = true;
+ gorc->refund_pending = pending;
}
@@ -1262,36 +1269,38 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
h_contract);
}
- ret = TALER_MHD_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o, s:I, s:I, s:o, s:O,"
- " s:s, s:b, s:b, s:o, s:o, s:o, s:s}",
- "wire_reports",
- gorc->wire_reports,
- "exchange_ec",
- (json_int_t) gorc->exchange_ec,
- "exchange_hc",
- (json_int_t) gorc->exchange_hc,
- "deposit_total",
- TALER_JSON_from_amount (
- &gorc->deposits_total),
- "contract_terms",
- gorc->contract_terms,
- "order_status",
- "paid",
- "refunded",
- gorc->refunded,
- "wired",
- wired,
- "refund_amount",
- TALER_JSON_from_amount (
- &gorc->refund_amount),
- "wire_details",
- gorc->wire_details,
- "refund_details",
- gorc->refund_details,
- "order_status_url",
- order_status_url);
+ ret = TALER_MHD_reply_json_pack (
+ connection,
+ MHD_HTTP_OK,
+ "{s:o, s:I, s:I, s:o, s:O,"
+ " s:s, s:b, s:b, s:b, s:o,"
+ " s:o, s:o, s:s}",
+ "wire_reports",
+ gorc->wire_reports,
+ "exchange_ec",
+ (json_int_t) gorc->exchange_ec,
+ "exchange_hc",
+ (json_int_t) gorc->exchange_hc,
+ "deposit_total",
+ TALER_JSON_from_amount (&gorc->deposits_total),
+ "contract_terms",
+ gorc->contract_terms,
+ "order_status",
+ "paid",
+ "refunded",
+ gorc->refunded,
+ "wired",
+ wired,
+ "refund_pending",
+ gorc->refund_pending,
+ "refund_amount",
+ TALER_JSON_from_amount (&gorc->refund_amount),
+ "wire_details",
+ gorc->wire_details,
+ "refund_details",
+ gorc->refund_details,
+ "order_status_url",
+ order_status_url);
GNUNET_free (order_status_url);
gorc->wire_details = NULL;
gorc->wire_reports = NULL;
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index d16822a2..cd678597 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -1753,6 +1753,12 @@ struct TALER_MERCHANT_OrderStatusResponse
bool refunded;
/**
+ * true if refunds were approved that have not yet been obtained
+ * by the wallet.
+ */
+ bool refund_pending;
+
+ /**
* true if the exchange paid the merchant for this order,
* false if not.
*/
diff --git a/src/lib/merchant_api_merchant_get_order.c b/src/lib/merchant_api_merchant_get_order.c
index b09b39ee..ae35f354 100644
--- a/src/lib/merchant_api_merchant_get_order.c
+++ b/src/lib/merchant_api_merchant_get_order.c
@@ -171,6 +171,8 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_bool ("refunded",
&osr.details.paid.refunded),
+ GNUNET_JSON_spec_bool ("refund_pending",
+ &osr.details.paid.refund_pending),
GNUNET_JSON_spec_bool ("wired",
&osr.details.paid.wired),
TALER_JSON_spec_amount ("deposit_total",