[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 211/277: adjust API to current spec
From: |
gnunet |
Subject: |
[taler-merchant] 211/277: adjust API to current spec |
Date: |
Sun, 05 Jul 2020 20:52:04 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit fdf89e8138cc239bd1cb11e9b71c30b9607f54b1
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Jun 13 22:51:37 2020 +0200
adjust API to current spec
---
.../taler-merchant-httpd_private-get-orders-ID.c | 8 +-
src/include/taler_merchant_service.h | 135 +++++++++++++--------
2 files changed, 93 insertions(+), 50 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 63b7148..5c7d6d8 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -935,9 +935,11 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler
*rh,
hc->instance->settings.id);
ret = TALER_MHD_reply_json_pack (connection,
MHD_HTTP_OK,
- "{s:s, s:b, s:s}",
+ "{s:s, s:O, s:b, s:s}",
"taler_pay_uri",
taler_pay_uri,
+ "contract_terms",
+ gorc->contract_terms,
"paid",
false,
"already_paid_order_id",
@@ -996,9 +998,11 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler
*rh,
hc->instance->settings.id);
ret = TALER_MHD_reply_json_pack (connection,
MHD_HTTP_OK,
- "{s:s, s:b}",
+ "{s:s, s:O, s:b}",
"taler_pay_uri",
taler_pay_uri,
+ "contract_terms",
+ gorc->contract_terms,
"paid",
false);
GNUNET_free (taler_pay_uri);
diff --git a/src/include/taler_merchant_service.h
b/src/include/taler_merchant_service.h
index 4ae3112..7ffa6b3 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -1485,16 +1485,14 @@ struct TALER_MERCHANT_WireTransfer
/**
- * Details about a conflicting response returned by the exchange.
+ * Details about a failures returned by the exchange when
+ * tracking wire transfers.
*/
-struct TALER_MERCHANT_WireConflict
+struct TALER_MERCHANT_WireReport
{
/**
- * Error code explaining the nature of the conflict. Can either be that
- * @e coin_pub is not (or with a different amount) included in @e
- * wtid_claim despite @e deposit_claim saying it should be, or that the
- * amounts in @e wtid_claim do not add up.
+ * Error code explaining the nature of the problem.
*/
enum TALER_ErrorCode code;
@@ -1509,21 +1507,34 @@ struct TALER_MERCHANT_WireConflict
struct TALER_CoinSpendPublicKeyP coin_pub;
/**
- * HTTP response data from the exchange (NULL if not available).
+ * HTTP response data from the exchange (fields are MAY BE NULL or 0 if not
+ * available).
*/
- const struct TALER_EXCHANGE_HttpResponse *hr;
+ struct TALER_EXCHANGE_HttpResponse hr;
+
+};
+
+
+/**
+ * Detail returned by the merchant backend about refunds.
+ */
+struct TALER_MERCHANT_RefundOrderDetail
+{
/**
- * A claim by the exchange about the transactions associated
- * with a given wire transfer, NULL if not available.
+ * Human-readable reason given for the refund.
*/
- const struct TALER_EXCHANGE_TransferData *wtid_claim;
+ const char *reason;
+
+ /**
+ * Time when the refund was granted.
+ */
+ struct GNUNET_TIME_Absolute refund_time;
/**
- * A claim by the exchange that the given transaction is included
- * in the above WTID, NULL if not available.
+ * Total amount that was refunded.
*/
- const struct TALER_EXCHANGE_DepositData *deposit_claim;
+ struct TALER_Amount refund_amount;
};
@@ -1535,11 +1546,18 @@ struct TALER_MERCHANT_OrderStatusResponse
{
/**
- * #GNUNET_YES if the payment is settled, #GNUNET_NO if not
- * settled, #GNUNET_SYSERR if we got conflicting transaction proofs.
+ * The full contract terms of the order.
+ */
+ const json_t *contract_terms;
+
+ /**
+ * true if the payment is settled, false if not settled.
*/
- enum GNUNET_GenericReturnValue paid;
+ bool paid;
+ /**
+ * Details depending on the payment status given in @e paid.
+ */
union
{
@@ -1549,15 +1567,15 @@ struct TALER_MERCHANT_OrderStatusResponse
struct
{
/**
- * Refunded #GNUNET_YES if there is at least on refund on this payment,
- * #GNUNET_NO if there are no refunds.
+ * Amount that was refunded.
*/
- enum GNUNET_GenericReturnValue refunded;
+ struct TALER_Amount refund_amount;
/**
- * Amount that was refunded.
+ * Amount that was deposited into our bank account,
+ * excluding fees.
*/
- struct TALER_Amount refund_amount;
+ struct TALER_Amount deposit_total;
/**
* Hash of the contract terms.
@@ -1571,10 +1589,56 @@ struct TALER_MERCHANT_OrderStatusResponse
struct TALER_MERCHANT_WireTransfer *wts;
/**
- * Length of the @e wt array.
+ * Length of the @e wts array.
*/
unsigned int wts_len;
+ /**
+ * Array of wire reports about problems tracking wire transfers.
+ * Of length @e wrs_len.
+ */
+ struct TALER_MERCHANT_WireReport *wrs;
+
+ /**
+ * Length of the @e wrs array.
+ */
+ unsigned int wrs_len;
+
+ /**
+ * Details returned by the merchant backend about refunds.
+ * Of length @e refunds_len.
+ */
+ struct TALER_MERCHANT_RefundOrderDetail *refunds;
+
+ /**
+ * Length of the @e refunds array.
+ */
+ unsigned int refunds_len;
+
+ /**
+ * Error code encountered trying to contact the exchange
+ * about the wire tracking, 0 for none.
+ */
+ enum TALER_ErrorCode exchange_ec;
+
+ /**
+ * HTTP status code encountered trying to contact the exchange
+ * about the wire tracking, 0 for no error.
+ */
+ unsigned int exchange_hc;
+
+ /**
+ * true if there is at least on refund on this payment,
+ * false if there are no refunds.
+ */
+ bool refunded;
+
+ /**
+ * true if the exchange paid the merchant for this order,
+ * false if not.
+ */
+ bool wired;
+
} paid;
/**
@@ -1597,31 +1661,6 @@ struct TALER_MERCHANT_OrderStatusResponse
} unpaid;
- /**
- * Details provided if @e paid is #GNUNET_SYSERR.
- */
- struct
- {
-
- /**
- * Length of the @e conflicts array.
- */
- unsigned int num_conficts;
-
- /**
- * Array of conflicting information returned by the exchange
- * concerning the payments made for this order.
- */
- struct TALER_MERCHANT_WireConflict *conflicts;
-
- /**
- * Losses we believe to have suffered as a result from
- * the @e conflicts (in total).
- */
- struct TALER_Amount total_loss;
-
- } conflict;
-
} details;
};
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] 190/277: implementation of GET /private/tips, (continued)
- [taler-merchant] 190/277: implementation of GET /private/tips, gnunet, 2020/07/05
- [taler-merchant] 191/277: test/fix for POST /private/reserves, gnunet, 2020/07/05
- [taler-merchant] 193/277: Merge branch 'protocolV1' of git+ssh://git.taler.net/merchant into protocolV1, gnunet, 2020/07/05
- [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 <=
- [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, 2020/07/05
- [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