summaryrefslogtreecommitdiff
path: root/src/include/taler_merchant_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-04-23 14:40:05 +0200
committerChristian Grothoff <christian@grothoff.org>2023-04-23 14:40:05 +0200
commit4b7d9f5e19e9f28ec1163f3b6e5c00f0805e6221 (patch)
tree396b8ddf6bf4b074d85737a27cec8a58a16237cf /src/include/taler_merchant_service.h
parentf8cb45f17a4bd9f9a4b68a4427ec485984703d33 (diff)
downloadmerchant-4b7d9f5e19e9f28ec1163f3b6e5c00f0805e6221.tar.gz
merchant-4b7d9f5e19e9f28ec1163f3b6e5c00f0805e6221.tar.bz2
merchant-4b7d9f5e19e9f28ec1163f3b6e5c00f0805e6221.zip
modernize POST /transfers API
Diffstat (limited to 'src/include/taler_merchant_service.h')
-rw-r--r--src/include/taler_merchant_service.h89
1 files changed, 73 insertions, 16 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index 49bc83fd..92e18335 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -2898,31 +2898,88 @@ struct TALER_MERCHANT_TrackTransferDetail
};
+
+/**
+ * @brief Response to a POST /transfers operation from a merchant's backend.
+ */
+struct TALER_MERCHANT_PostTransfersResponse
+{
+ /**
+ * HTTP response details
+ */
+ struct TALER_MERCHANT_HttpResponse hr;
+
+ /**
+ * Details depending on HTTP status.
+ */
+ union
+ {
+
+ /**
+ * Details in case of success (#MHD_HTTP_OK).
+ */
+ struct
+ {
+
+ /**
+ * when did the transfer happen (according to the exchange)
+ */
+ struct GNUNET_TIME_Timestamp execution_time;
+
+ /**
+ * total amount of the wire transfer
+ */
+ struct TALER_Amount total_amount;
+
+ /**
+ * how much did the exchange charge in terms of wire fees
+ */
+ struct TALER_Amount wire_fee;
+
+ /**
+ * Length of the @e details array
+ */
+ unsigned int details_length;
+
+ /**
+ * array with details about the combined transactions
+ */
+ const struct TALER_MERCHANT_TrackTransferDetail *details;
+ } success;
+
+ /**
+ * Details if we got an #MHD_HTTP_BAD_GATEWAY.
+ */
+ struct
+ {
+ /**
+ * HTTP status of the exchange (or 0 if not available).
+ */
+ unsigned int exchange_http_status;
+
+ /**
+ * Error code of the exchange (or TALER_EC_NONE if not available).
+ */
+ enum TALER_ErrorCode exchange_ec;
+
+ } bad_gateway;
+
+ } details;
+
+};
+
+
/**
* Callbacks of this type are used to work the result of submitting a
* POST /transfers request to a merchant
*
* @param cls closure
- * @param hr HTTP response details
- * @param execution_time when did the transfer happen (according to the exchange),
- * #GNUNET_TIME_UNIT_FOREVER_ABS if the transfer did not yet happen or if
- * we have no data from the exchange about it
- * @param total_amount total amount of the wire transfer, or NULL if the exchange did
- * not provide any details
- * @param wire_fee how much did the exchange charge in terms of wire fees, or NULL
- * if the exchange did not provide any details
- * @param details_length length of the @a details array
- * @param details array with details about the combined transactions
+ * @param ptr response details
*/
typedef void
(*TALER_MERCHANT_PostTransfersCallback) (
void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- struct GNUNET_TIME_Timestamp execution_time,
- const struct TALER_Amount *total_amount,
- const struct TALER_Amount *wire_fee,
- unsigned int details_length,
- const struct TALER_MERCHANT_TrackTransferDetail details[]);
+ const struct TALER_MERCHANT_PostTransfersResponse *ptr);
/**