summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_deposits_get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_deposits_get.c')
-rw-r--r--src/testing/testing_api_cmd_deposits_get.c74
1 files changed, 42 insertions, 32 deletions
diff --git a/src/testing/testing_api_cmd_deposits_get.c b/src/testing/testing_api_cmd_deposits_get.c
index 42dc1cb81..5d4436e2a 100644
--- a/src/testing/testing_api_cmd_deposits_get.c
+++ b/src/testing/testing_api_cmd_deposits_get.c
@@ -40,6 +40,11 @@ struct TrackTransactionState
const char *bank_transfer_reference;
/**
+ * Our command.
+ */
+ const struct TALER_TESTING_Command *cmd;
+
+ /**
* The WTID associated by the transaction being tracked.
*/
struct TALER_WireTransferIdentifierRawP wtid;
@@ -50,10 +55,18 @@ struct TrackTransactionState
unsigned int expected_response_code;
/**
- * Set to the KYC UUID *if* the exchange replied with
+ * Set to the KYC requirement payto hash *if* the exchange replied with a
+ * request for KYC (#MHD_HTTP_ACCEPTED).
+ * Note: set based on our @e merchant_payto_uri, as
+ * the exchange does not respond with the payto hash.
+ */
+ struct TALER_PaytoHashP h_payto;
+
+ /**
+ * Set to the KYC requirement row *if* the exchange replied with
* a request for KYC (#MHD_HTTP_ACCEPTED).
*/
- uint64_t kyc_uuid;
+ uint64_t requirement_row;
/**
* Reference to any operation that can provide a transaction.
@@ -99,28 +112,19 @@ deposit_wtid_cb (void *cls,
{
struct TrackTransactionState *tts = cls;
struct TALER_TESTING_Interpreter *is = tts->is;
- struct TALER_TESTING_Command *cmd = &is->commands[is->ip];
tts->tth = NULL;
if (tts->expected_response_code != dr->hr.http_status)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u/%d to command %s in %s:%u\n",
- dr->hr.http_status,
- (int) dr->hr.ec,
- cmd->label,
- __FILE__,
- __LINE__);
- json_dumpf (dr->hr.reply,
- stderr,
- 0);
- TALER_TESTING_interpreter_fail (is);
+ TALER_TESTING_unexpected_status (is,
+ dr->hr.http_status,
+ tts->expected_response_code);
return;
}
switch (dr->hr.http_status)
{
case MHD_HTTP_OK:
- tts->wtid = dr->details.success.wtid;
+ tts->wtid = dr->details.ok.wtid;
if (NULL != tts->bank_transfer_reference)
{
const struct TALER_TESTING_Command *bank_transfer_cmd;
@@ -147,7 +151,7 @@ deposit_wtid_cb (void *cls,
}
/* Compare that expected and gotten subjects match. */
- if (0 != GNUNET_memcmp (&dr->details.success.wtid,
+ if (0 != GNUNET_memcmp (&dr->details.ok.wtid,
wtid_want))
{
GNUNET_break (0);
@@ -158,7 +162,10 @@ deposit_wtid_cb (void *cls,
break;
case MHD_HTTP_ACCEPTED:
/* allowed, nothing to check here */
- tts->kyc_uuid = dr->details.accepted.payment_target_uuid;
+ TALER_payto_hash (tts->merchant_payto_uri,
+ &tts->h_payto);
+ tts->requirement_row
+ = dr->details.accepted.requirement_row;
break;
case MHD_HTTP_NOT_FOUND:
/* allowed, nothing to check here */
@@ -193,7 +200,7 @@ track_transaction_run (void *cls,
struct TALER_PrivateContractHashP h_contract_terms;
const struct TALER_MerchantPrivateKeyP *merchant_priv;
- (void) cmd;
+ tts->cmd = cmd;
tts->is = is;
transaction_cmd
= TALER_TESTING_interpreter_lookup_command (tts->is,
@@ -265,13 +272,17 @@ track_transaction_run (void *cls,
return;
}
- tts->tth = TALER_EXCHANGE_deposits_get (is->exchange,
- merchant_priv,
- &h_wire_details,
- &h_contract_terms,
- &coin_pub,
- &deposit_wtid_cb,
- tts);
+ tts->tth = TALER_EXCHANGE_deposits_get (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
+ merchant_priv,
+ &h_wire_details,
+ &h_contract_terms,
+ &coin_pub,
+ GNUNET_TIME_UNIT_ZERO,
+ &deposit_wtid_cb,
+ tts);
GNUNET_assert (NULL != tts->tth);
}
@@ -291,10 +302,8 @@ track_transaction_cleanup (void *cls,
if (NULL != tts->tth)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Command %u (%s) did not complete\n",
- tts->is->ip,
- cmd->label);
+ TALER_TESTING_command_incomplete (tts->is,
+ cmd->label);
TALER_EXCHANGE_deposits_get_cancel (tts->tth);
tts->tth = NULL;
}
@@ -321,9 +330,10 @@ track_transaction_traits (void *cls,
struct TrackTransactionState *tts = cls;
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_wtid (&tts->wtid),
- TALER_TESTING_make_trait_payment_target_uuid (&tts->kyc_uuid),
- TALER_TESTING_make_trait_payto_uri (
- (const char **) &tts->merchant_payto_uri),
+ TALER_TESTING_make_trait_legi_requirement_row (
+ &tts->requirement_row),
+ TALER_TESTING_make_trait_h_payto (&tts->h_payto),
+ TALER_TESTING_make_trait_payto_uri (tts->merchant_payto_uri),
TALER_TESTING_trait_end ()
};