diff options
-rw-r--r-- | src/backend/taler-merchant-httpd_get-orders-ID.c | 3 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_private-get-orders-ID.c | 69 | ||||
-rw-r--r-- | src/include/taler_merchant_service.h | 6 | ||||
-rw-r--r-- | src/lib/merchant_api_merchant_get_order.c | 2 |
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", |