[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 184/277: work on implementing GET /private/orders/ID
From: |
gnunet |
Subject: |
[taler-merchant] 184/277: work on implementing GET /private/orders/ID |
Date: |
Sun, 05 Jul 2020 20:51:37 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit fcf60499c3ab3e23c458cecdf8f51dd7cf5e16d3
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jun 7 21:58:18 2020 +0200
work on implementing GET /private/orders/ID
---
.../taler-merchant-httpd_private-get-orders-ID.c | 79 +++++++++++++---------
1 file changed, 48 insertions(+), 31 deletions(-)
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 e82a121..78fe4e1 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -514,21 +514,24 @@ gorc_cleanup (void *cls)
* It is responsible for summing up the refund amount.
*
* @param cls closure
+ * @param refund_serial unique serial number of the refund
+ * @param timestamp time of the refund (for grouping of refunds in the wallet
UI)
* @param coin_pub public coin from which the refund comes from
* @param exchange_url URL of the exchange that issued @a coin_pub
* @param rtransaction_id identificator of the refund
* @param reason human-readable explanation of the refund
+ * @param timestamp when was the refund made
* @param refund_amount refund amount which is being taken from @a coin_pub
- * @param refund_fee cost of this refund operation
*/
static void
process_refunds_cb (void *cls,
+ uint64_t refund_serial,
+ struct GNUNET_TIME_Absolute timestamp,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *exchange_url,
uint64_t rtransaction_id,
const char *reason,
- const struct TALER_Amount *refund_amount,
- const struct TALER_Amount *refund_fee)
+ const struct TALER_Amount *refund_amount)
{
struct GetOrderRequestContext *gorc = cls;
@@ -538,12 +541,15 @@ process_refunds_cb (void *cls,
GNUNET_assert (NULL != gorc->refund_details);
}
GNUNET_assert (0 ==
- json_array_append_new (json_pack ("{s:s}",
+ json_array_append_new (json_pack ("{s:o, s:o, s:s}",
+ "amount",
+ TALER_JSON_from_amount (
+ refund_amount),
+ "timestamp",
+
GNUNET_JSON_from_time_absolute (
+ timestamp),
"reason",
reason)));
- // FIXME: properly setup json_pack above
- // with the details on the refund
- // FIXME: update spec accordingly!
if (gorc->refunded)
{
GNUNET_assert (0 <=
@@ -877,12 +883,11 @@ TMH_private_get_orders_ID (const struct
TMH_RequestHandler *rh,
/* Accumulate refunds, if any. */
{
-
- qs = TMH_db->lookup_refunds (TMH_db->cls,
- hc->instance.settings->id,
- &h_contract_terms,
- &process_refunds_cb,
- gorc);
+ qs = TMH_db->lookup_refunds_detailed (TMH_db->cls,
+ hc->instance.settings->id,
+ &h_contract_terms,
+ &process_refunds_cb,
+ gorc);
}
if (0 > qs)
{
@@ -945,26 +950,38 @@ TMH_private_get_orders_ID (const struct
TMH_RequestHandler *rh,
}
}
- // FIXME: also return gorc->ec/exchange_(hc,ec) codes
- // and the gorc->value_total/deposits_total/etc.
ret = TALER_MHD_reply_json_pack (connection,
MHD_HTTP_OK,
- "{s:O, s:b, s:b, s:o?, s:o?, s:o}",
- "contract_terms",
- gorc->contract_terms,
- "paid",
- true,
- "refunded",
- gorc->refunded,
- "refund_amount",
- (gorc->refunded)
- ? TALER_JSON_from_amount (
- &gorc->refund_amount)
- : NULL,
- "wire_details",
- gorc->wire_details,
- "refund_details",
- gorc->refund_details);
+ "{s:I, s:I, s:I, s:o, s:o,"
+ " s:O, s:b, s:b, s:o?, s:o?, s:o?}",
+ "wire_ec",
+ (json_int_t) gorc->wire_ec,
+ "exchange_ec",
+ (json_int_t) gorc->exchange_ec,
+ "exchange_hc",
+ (json_int_t) gorc->exchange_hc,
+ "transfer_value_total",
+ TALER_JSON_from_amount (
+ &gorc->value_total)
+ "deposit_total",
+ TALER_JSON_from_amount (
+ &gorc->deposits_total)
+ : NULL,
+ "contract_terms",
+ gorc->contract_terms,
+ "paid",
+ true,
+ "refunded",
+ gorc->refunded,
+ "refund_amount",
+ (gorc->refunded)
+ ? TALER_JSON_from_amount (
+ &gorc->refund_amount)
+ : NULL,
+ "wire_details",
+ gorc->wire_details,
+ "refund_details",
+ gorc->refund_details);
gorc->wire_details = NULL;
gorc->refund_details = NULL;
return ret;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] 174/277: new backenddb APIs for GET /private/orders/ID, (continued)
- [taler-merchant] 174/277: new backenddb APIs for GET /private/orders/ID, gnunet, 2020/07/05
- [taler-merchant] 168/277: implement GET /reserves/RESERVE_ID, gnunet, 2020/07/05
- [taler-merchant] 167/277: implement TALER_MERCHANT_reserves_get(), gnunet, 2020/07/05
- [taler-merchant] 173/277: Merge branch 'protocolV1' of git+ssh://git.taler.net/merchant into protocolV1, gnunet, 2020/07/05
- [taler-merchant] 172/277: first high-level hack job at GET /orders/ID -- certainly FTBFS still, gnunet, 2020/07/05
- [taler-merchant] 176/277: cleaned backenddb test code, completed tests for instances & products, gnunet, 2020/07/05
- [taler-merchant] 179/277: Merge branch 'protocolV1' of git+ssh://git.taler.net/merchant into protocolV1, gnunet, 2020/07/05
- [taler-merchant] 185/277: headers and empty source files for GET /private/tips, gnunet, 2020/07/05
- [taler-merchant] 178/277: work on GET /private/orders/ID", gnunet, 2020/07/05
- [taler-merchant] 177/277: wrote method for delete reserve, gnunet, 2020/07/05
- [taler-merchant] 184/277: work on implementing GET /private/orders/ID,
gnunet <=
- [taler-merchant] 183/277: work on getting TransactionWireTransfer reply built, gnunet, 2020/07/05
- [taler-merchant] 180/277: more work on private-get-orders-ID, gnunet, 2020/07/05
- [taler-merchant] 186/277: start to build get-orders-ID, gnunet, 2020/07/05
- [taler-merchant] 181/277: more test cleanup and some lookup_orders filter tests, gnunet, 2020/07/05
- [taler-merchant] 192/277: need #include, gnunet, 2020/07/05
- [taler-merchant] 197/277: remove from waiting list when resuming, gnunet, 2020/07/05
- [taler-merchant] 196/277: do not forget to kick MHD, gnunet, 2020/07/05
- [taler-merchant] 189/277: created lookup_tips method for backenddb, gnunet, 2020/07/05
- [taler-merchant] 194/277: finish FIXMEs in private-get-orders-ID:, gnunet, 2020/07/05
- [taler-merchant] 195/277: remark, gnunet, 2020/07/05