gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: expose refund_pending status in


From: gnunet
Subject: [taler-merchant] branch master updated: expose refund_pending status in GET /private/orders/<ID> operation. Fixes #6491.
Date: Tue, 20 Oct 2020 20:24:06 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 3a74de2  expose refund_pending status in GET /private/orders/<ID> 
operation. Fixes #6491.
3a74de2 is described below

commit 3a74de266c9724c6b804244e14870cd017e8a721
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Oct 20 20:24:03 2020 +0200

    expose refund_pending status in GET /private/orders/<ID> operation. Fixes 
#6491.
---
 src/backend/taler-merchant-httpd_get-orders-ID.c   |  3 +-
 .../taler-merchant-httpd_private-get-orders-ID.c   | 69 ++++++++++++----------
 src/include/taler_merchant_service.h               |  6 ++
 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 82404f6..5c6949b 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 49bd63c..9f0b9fe 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -250,6 +250,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 d16822a..cd67859 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -1752,6 +1752,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 b09b39e..ae35f35 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",

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]