summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_deposit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-11-01 13:17:44 +0100
committerChristian Grothoff <christian@grothoff.org>2021-11-01 13:17:44 +0100
commitf02b5b78592159b690e4c090879a62c170f8527f (patch)
tree0ff66438dcdc8ea88dc5fda88f1a1f61103e85d4 /src/testing/testing_api_cmd_deposit.c
parentd68dc69b4c5d0f15252fa06d2e92aac5423a4416 (diff)
downloadexchange-f02b5b78592159b690e4c090879a62c170f8527f.tar.gz
exchange-f02b5b78592159b690e4c090879a62c170f8527f.tar.bz2
exchange-f02b5b78592159b690e4c090879a62c170f8527f.zip
fix bug
Diffstat (limited to 'src/testing/testing_api_cmd_deposit.c')
-rw-r--r--src/testing/testing_api_cmd_deposit.c95
1 files changed, 18 insertions, 77 deletions
diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c
index 81e9814de..de04df244 100644
--- a/src/testing/testing_api_cmd_deposit.c
+++ b/src/testing/testing_api_cmd_deposit.c
@@ -299,15 +299,6 @@ deposit_run (void *cls,
GNUNET_JSON_spec_end ()
};
- if (GNUNET_OK !=
- GNUNET_JSON_parse (ds->wire_details,
- spec,
- NULL, NULL))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (is);
- return;
- }
(void) cmd;
ds->is = is;
if (NULL != ds->deposit_reference)
@@ -328,6 +319,7 @@ deposit_run (void *cls,
ds->coin_reference = ods->coin_reference;
ds->coin_index = ods->coin_index;
ds->wire_details = json_incref (ods->wire_details);
+ GNUNET_assert (NULL != ds->wire_details);
ds->contract_terms = json_incref (ods->contract_terms);
ds->wallet_timestamp = ods->wallet_timestamp;
ds->refund_deadline = ods->refund_deadline;
@@ -359,6 +351,19 @@ deposit_run (void *cls,
}
ds->merchant_priv = *merchant_priv;
}
+ GNUNET_assert (NULL != ds->wire_details);
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (ds->wire_details,
+ spec,
+ NULL, NULL))
+ {
+ json_dumpf (ds->wire_details,
+ stderr,
+ JSON_INDENT (2));
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (is);
+ return;
+ }
GNUNET_assert (ds->coin_reference);
coin_cmd = TALER_TESTING_interpreter_lookup_command (is,
ds->coin_reference);
@@ -563,28 +568,6 @@ deposit_traits (void *cls,
}
-/**
- * Create a "deposit" command.
- *
- * @param label command label.
- * @param coin_reference reference to any operation that can
- * provide a coin.
- * @param coin_index if @a withdraw_reference offers an array of
- * coins, this parameter selects which one in that array.
- * This value is currently ignored, as only one-coin
- * withdrawals are implemented.
- * @param target_account_payto target account for the "deposit"
- * request.
- * @param contract_terms contract terms to be signed over by the
- * coin.
- * @param refund_deadline refund deadline, zero means 'no refunds'.
- * Note, if time were absolute, then it would have come
- * one day and disrupt tests meaning.
- * @param amount how much is going to be deposited.
- * @param expected_response_code expected HTTP response code.
- *
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_deposit (const char *label,
const char *coin_reference,
@@ -596,13 +579,12 @@ TALER_TESTING_cmd_deposit (const char *label,
unsigned int expected_response_code)
{
struct DepositState *ds;
- json_t *wire_details;
- wire_details = TALER_TESTING_make_wire_details (target_account_payto);
ds = GNUNET_new (struct DepositState);
ds->coin_reference = coin_reference;
ds->coin_index = coin_index;
- ds->wire_details = wire_details;
+ ds->wire_details = TALER_TESTING_make_wire_details (target_account_payto);
+ GNUNET_assert (NULL != ds->wire_details);
ds->contract_terms = json_loads (contract_terms,
JSON_REJECT_DUPLICATES,
NULL);
@@ -648,30 +630,6 @@ TALER_TESTING_cmd_deposit (const char *label,
}
-/**
- * Create a "deposit" command that references an existing merchant key.
- *
- * @param label command label.
- * @param coin_reference reference to any operation that can
- * provide a coin.
- * @param coin_index if @a withdraw_reference offers an array of
- * coins, this parameter selects which one in that array.
- * This value is currently ignored, as only one-coin
- * withdrawals are implemented.
- * @param target_account_payto target account for the "deposit"
- * request.
- * @param contract_terms contract terms to be signed over by the
- * coin.
- * @param refund_deadline refund deadline, zero means 'no refunds'.
- * Note, if time were absolute, then it would have come
- * one day and disrupt tests meaning.
- * @param amount how much is going to be deposited.
- * @param expected_response_code expected HTTP response code.
- * @param merchant_priv_reference reference to another operation
- * that has a merchant private key trait
- *
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_deposit_with_ref (const char *label,
const char *coin_reference,
@@ -684,14 +642,13 @@ TALER_TESTING_cmd_deposit_with_ref (const char *label,
const char *merchant_priv_reference)
{
struct DepositState *ds;
- json_t *wire_details;
- wire_details = TALER_TESTING_make_wire_details (target_account_payto);
ds = GNUNET_new (struct DepositState);
ds->merchant_priv_reference = merchant_priv_reference;
ds->coin_reference = coin_reference;
ds->coin_index = coin_index;
- ds->wire_details = wire_details;
+ ds->wire_details = TALER_TESTING_make_wire_details (target_account_payto);
+ GNUNET_assert (NULL != ds->wire_details);
ds->contract_terms = json_loads (contract_terms,
JSON_REJECT_DUPLICATES,
NULL);
@@ -736,15 +693,6 @@ TALER_TESTING_cmd_deposit_with_ref (const char *label,
}
-/**
- * Create a "deposit" command that repeats an existing
- * deposit command.
- *
- * @param label command label.
- * @param deposit_reference which deposit command should we repeat
- * @param expected_response_code expected HTTP response code.
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_deposit_replay (const char *label,
const char *deposit_reference,
@@ -769,13 +717,6 @@ TALER_TESTING_cmd_deposit_replay (const char *label,
}
-/**
- * Modify a deposit command to enable retries when we get transient
- * errors from the exchange.
- *
- * @param cmd a deposit command
- * @return the command with retries enabled
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_deposit_with_retry (struct TALER_TESTING_Command cmd)
{