summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_post_transfers.c
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-03 18:23:46 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-03 18:23:46 -0400
commit33d332a637d77524f140a20c0b636177276224a9 (patch)
treea0aa460e89e7379c6fd83ba19229bec54779c7d8 /src/testing/testing_api_cmd_post_transfers.c
parentc4dc3bf39183559ddcfeafba65ef3d8635bc13fe (diff)
downloadmerchant-33d332a637d77524f140a20c0b636177276224a9.tar.gz
merchant-33d332a637d77524f140a20c0b636177276224a9.tar.bz2
merchant-33d332a637d77524f140a20c0b636177276224a9.zip
test GET /private/transfers
Diffstat (limited to 'src/testing/testing_api_cmd_post_transfers.c')
-rw-r--r--src/testing/testing_api_cmd_post_transfers.c46
1 files changed, 43 insertions, 3 deletions
diff --git a/src/testing/testing_api_cmd_post_transfers.c b/src/testing/testing_api_cmd_post_transfers.c
index 768b76a4..100ea32d 100644
--- a/src/testing/testing_api_cmd_post_transfers.c
+++ b/src/testing/testing_api_cmd_post_transfers.c
@@ -98,6 +98,11 @@ struct PostTransfersState
* Set to true once @e wtid and @e exchange_url are initialized.
*/
bool found;
+
+ /**
+ * When the exchange executed the transfer.
+ */
+ struct GNUNET_TIME_Absolute execution_time;
};
@@ -142,9 +147,10 @@ transfers_cb (void *cls,
{
case MHD_HTTP_OK:
{
- /*
- struct TALER_Amount total;
+ // struct TALER_Amount total;
+ pts->execution_time = execution_time;
+ /*
if (0 >
TALER_amount_subtract (&total,
total_amount,
@@ -284,6 +290,39 @@ transfers_cb (void *cls,
/**
+ * Offers information from the POST /transfers CMD state to other
+ * commands.
+ *
+ * @param cls closure
+ * @param ret[out] result (could be anything)
+ * @param trait name of the trait
+ * @param index index number of the object to extract.
+ * @return #GNUNET_OK on success
+ */
+static int
+post_transfers_traits (void *cls,
+ const void **ret,
+ const char *trait,
+ unsigned int index)
+{
+ struct PostTransfersState *pts = cls;
+ struct TALER_TESTING_Trait traits[] = {
+ TALER_TESTING_make_trait_wtid (0, &pts->wtid),
+ TALER_TESTING_make_trait_string (0, pts->payto_uri),
+ TALER_TESTING_make_trait_amount_obj (0, &pts->credit_amount),
+ TALER_TESTING_make_trait_string (1, pts->exchange_url),
+ TALER_TESTING_make_trait_absolute_time (0, &pts->execution_time),
+ TALER_TESTING_trait_end (),
+ };
+
+ return TALER_TESTING_get_trait (traits,
+ ret,
+ trait,
+ index);
+}
+
+
+/**
* Callbacks of this type are used to serve the result of asking
* the bank for the debit transaction history.
*
@@ -468,7 +507,8 @@ TALER_TESTING_cmd_merchant_post_transfer (
.cls = pts,
.label = label,
.run = &post_transfers_run,
- .cleanup = &post_transfers_cleanup
+ .cleanup = &post_transfers_cleanup,
+ .traits = &post_transfers_traits
};
return cmd;