summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_merchant_get_tip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_merchant_get_tip.c')
-rw-r--r--src/testing/testing_api_cmd_merchant_get_tip.c56
1 files changed, 22 insertions, 34 deletions
diff --git a/src/testing/testing_api_cmd_merchant_get_tip.c b/src/testing/testing_api_cmd_merchant_get_tip.c
index 1ea5229d..a8e7a67e 100644
--- a/src/testing/testing_api_cmd_merchant_get_tip.c
+++ b/src/testing/testing_api_cmd_merchant_get_tip.c
@@ -79,25 +79,11 @@ struct MerchantTipGetState
* Callback for a GET /private/tips/$TIP_ID operation.
*
* @param cls closure for this function
- * @param hr http response
- * @param total_authorized the total amount authorized for the tip
- * @param total_picked_up the total amount of the tip that has been picked up
- * @param reason why the tip was authorized
- * @param expiration when the tip will expire
- * @param reserve_pub public key of the reserve the tip is drawing from
- * @param pickups_length number of pickups associated with the tip
- * @param pickups the array of pickups associated with the tip
+ * @param tsr response
*/
static void
merchant_get_tip_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const struct TALER_Amount *total_authorized,
- const struct TALER_Amount *total_picked_up,
- const char *reason,
- struct GNUNET_TIME_Timestamp expiration,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- unsigned int pickups_length,
- const struct TALER_MERCHANT_PickupDetail pickups[])
+ const struct TALER_MERCHANT_TipStatusResponse *tsr)
{
struct MerchantTipGetState *gts = cls;
const struct TALER_TESTING_Command *authorize_cmd;
@@ -107,33 +93,33 @@ merchant_get_tip_cb (void *cls,
gts->tip_reference);
gts->tgh = NULL;
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (total_picked_up->currency,
- &expected_total_picked_up));
- if (gts->http_status != hr->http_status)
+ if (gts->http_status != tsr->hr.http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u (%d) to command %s\n",
- hr->http_status,
- (int) hr->ec,
+ tsr->hr.http_status,
+ (int) tsr->hr.ec,
TALER_TESTING_interpreter_get_current_label (gts->is));
TALER_TESTING_interpreter_fail (gts->is);
return;
}
- switch (hr->http_status)
+ switch (tsr->hr.http_status)
{
case MHD_HTTP_OK:
{
const struct TALER_Amount *initial_amount;
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (tsr->details.success.total_picked_up.currency,
+ &expected_total_picked_up));
if (GNUNET_OK !=
TALER_TESTING_get_trait_amount (authorize_cmd,
&initial_amount))
TALER_TESTING_FAIL (gts->is);
if ((GNUNET_OK !=
- TALER_amount_cmp_currency (total_authorized,
+ TALER_amount_cmp_currency (&tsr->details.success.total_authorized,
initial_amount)) ||
- (0 != TALER_amount_cmp (total_authorized,
+ (0 != TALER_amount_cmp (&tsr->details.success.total_authorized,
initial_amount)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -149,7 +135,7 @@ merchant_get_tip_cb (void *cls,
TALER_TESTING_get_trait_reason (authorize_cmd,
&justification))
TALER_TESTING_FAIL (gts->is);
- if (0 != strcmp (reason,
+ if (0 != strcmp (tsr->details.success.reason,
*justification))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -168,7 +154,7 @@ merchant_get_tip_cb (void *cls,
TALER_TESTING_FAIL (gts->is);
if (GNUNET_TIME_timestamp_cmp (*tip_expiration,
!=,
- expiration))
+ tsr->details.success.expiration))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Tip authorized expiration does not match\n");
@@ -176,7 +162,7 @@ merchant_get_tip_cb (void *cls,
return;
}
}
- if (pickups_length != gts->pickups_length)
+ if (tsr->details.success.pickups_length != gts->pickups_length)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Length of pickups array does not match\n");
@@ -184,7 +170,7 @@ merchant_get_tip_cb (void *cls,
return;
}
{
- for (unsigned int i = 0; i < pickups_length; ++i)
+ for (unsigned int i = 0; i < gts->pickups_length; ++i)
{
const struct TALER_TESTING_Command *pickup_cmd;
@@ -198,7 +184,7 @@ merchant_get_tip_cb (void *cls,
&num_planchets))
TALER_TESTING_FAIL (gts->is);
- if (*num_planchets != pickups[i].num_planchets)
+ if (*num_planchets != tsr->details.success.pickups[i].num_planchets)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Pickup planchet count does not match\n");
@@ -216,9 +202,9 @@ merchant_get_tip_cb (void *cls,
if ( (GNUNET_OK !=
TALER_amount_cmp_currency (total,
- &pickups[i].requested_amount)) ||
+ &tsr->details.success.pickups[i].requested_amount)) ||
(0 != TALER_amount_cmp (total,
- &pickups[i].requested_amount)))
+ &tsr->details.success.pickups[i].requested_amount)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Pickup planchet sum does not match\n");
@@ -232,10 +218,10 @@ merchant_get_tip_cb (void *cls,
}
if ( (GNUNET_OK !=
TALER_amount_cmp_currency (&expected_total_picked_up,
- total_picked_up)) ||
+ &tsr->details.success.total_picked_up)) ||
(0 !=
TALER_amount_cmp (&expected_total_picked_up,
- total_picked_up)) )
+ &tsr->details.success.total_picked_up)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Tip picked up amount does not match\n");
@@ -280,6 +266,8 @@ merchant_get_tip_run (void *cls,
tgs->tgh = TALER_MERCHANT_merchant_tip_get (is->ctx,
tgs->merchant_url,
tip_id,
+ NULL,
+ GNUNET_TIME_UNIT_ZERO,
tgs->fetch_pickups,
&merchant_get_tip_cb,
tgs);