merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit fbd93498c3a1135986470c869a9db1a75b8886c4
parent ab6ee1680d16905ef938380e49c86710fb5c7155
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  6 Jun 2020 21:40:49 +0200

work on getting TransactionWireTransfer reply built

Diffstat:
Msrc/backend/taler-merchant-httpd_private-get-orders-ID.c | 34+++++++++++++++++++++++++++-------
Msrc/include/taler_merchantdb_plugin.h | 8+++++++-
2 files changed, 34 insertions(+), 8 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 @@ -562,7 +562,11 @@ process_refunds_cb (void *cls, * the response. * * @param cls a `struct GetOrderRequestContext` - * @param wtid wire transfer subject of the wire transfer for the coin + * @param wtid wire transfer subject of the wire transfer for the coin, + * or NULL if transfer is yet to be made + * @param exchange_url base URL of the exchange that made the payment + * @param execution_time when was the payment made (or in the future, + * when is it expected to be made) * @param deposit_value contribution of the coin to the total wire transfer value * @param deposit_fee deposit fee charged by the exchange for the coin * @param transfer_confirmed did the merchant confirm that a wire transfer with @@ -571,20 +575,36 @@ process_refunds_cb (void *cls, static void process_transfer_details (void *cls, const struct TALER_WireTransferIdentifierRawP *wtid, + const char *exchange_url, + struct GNUNET_TIME_Absolute execution_time, const struct TALER_Amount *deposit_value, const struct TALER_Amount *deposit_fee, bool transfer_confirmed) { struct GetOrderRequestContext *gorc = cls; json_t *wire_details = gorc->wire_details; + struct TALER_Amount wired; + GNUNET_assert + (0 <= TALER_amount_subtract (&wired, + deposit_value, + deposit_fee)); GNUNET_assert (0 == - json_array_append_new (wire_details, - json_pack ("{s:s, s:b}", - "blah", - "FIXME", - "confirmed", - transfer_confirmed))); + json_array_append_new ( + wire_details, + json_pack ("{s:o?, s:s, s:o, s:o, s:b}", + "wtid", + (NULL != wtid) + ? GNUNET_JSON_from_data_auto (wtid) + : NULL, + "exchange_url", + exchange_url, + "amount", + TALER_JSON_from_amount (&wired), + "execution_time", + GNUNET_JSON_from_time_absolute (execution_time), + "confirmed", + transfer_confirmed))); } diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h @@ -341,7 +341,11 @@ typedef void * FIXME: not implemented yet! * * @param cls closure - * @param wtid wire transfer subject of the wire transfer for the coin + * @param wtid wire transfer subject of the wire transfer for the coin, + * or NULL if transfer is yet to be made + * @param exchange_url base URL of the exchange that made the payment + * @param execution_time when was the payment made (or in the future, + * when is it expected to be made) * @param deposit_value contribution of the coin to the total wire transfer value * @param deposit_fee deposit fee charged by the exchange for the coin * @param transfer_confirmed did the merchant confirm that a wire transfer with @@ -351,6 +355,8 @@ typedef void (*TALER_MERCHANTDB_OrderTransferDetailsCallback)( void *cls, const struct TALER_WireTransferIdentifierRawP *wtid, + const char *exchange_url, + struct GNUNET_TIME_Absolute execution_time, const struct TALER_Amount *deposit_value, const struct TALER_Amount *deposit_fee, bool transfer_confirmed);