aboutsummaryrefslogtreecommitdiff
path: root/src/exchange-lib/test_exchange_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange-lib/test_exchange_api.c')
-rw-r--r--src/exchange-lib/test_exchange_api.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c
index 4c10ea8f6..c6cecc572 100644
--- a/src/exchange-lib/test_exchange_api.c
+++ b/src/exchange-lib/test_exchange_api.c
@@ -388,7 +388,7 @@ struct Command
/**
* JSON string describing what a proposal is about.
*/
- const char *proposal_data;
+ const char *contract_terms;
/**
* Relative time (to add to 'now') to compute the refund deadline.
@@ -2185,7 +2185,7 @@ interpreter_run (void *cls)
return;
case OC_DEPOSIT:
{
- struct GNUNET_HashCode h_proposal_data;
+ struct GNUNET_HashCode h_contract_terms;
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
const struct TALER_EXCHANGE_DenomPublicKey *coin_pk;
const struct TALER_DenominationSignature *coin_pk_sig;
@@ -2196,7 +2196,7 @@ interpreter_run (void *cls)
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
struct TALER_MerchantPublicKeyP merchant_pub;
- json_t *proposal_data;
+ json_t *contract_terms;
json_t *wire;
GNUNET_assert (NULL !=
@@ -2239,22 +2239,22 @@ interpreter_run (void *cls)
fail (is);
return;
}
- proposal_data = json_loads (cmd->details.deposit.proposal_data,
+ contract_terms = json_loads (cmd->details.deposit.contract_terms,
JSON_REJECT_DUPLICATES,
NULL);
- if (NULL == proposal_data)
+ if (NULL == contract_terms)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to parse proposal data `%s' at %u/%s\n",
- cmd->details.deposit.proposal_data,
+ cmd->details.deposit.contract_terms,
is->ip,
cmd->label);
fail (is);
return;
}
- TALER_JSON_hash (proposal_data,
- &h_proposal_data);
- json_decref (proposal_data);
+ TALER_JSON_hash (contract_terms,
+ &h_contract_terms);
+ json_decref (contract_terms);
wire = json_loads (cmd->details.deposit.wire_details,
JSON_REJECT_DUPLICATES,
NULL);
@@ -2297,7 +2297,7 @@ interpreter_run (void *cls)
memset (&dr, 0, sizeof (dr));
dr.purpose.size = htonl (sizeof (struct TALER_DepositRequestPS));
dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT);
- dr.h_proposal_data = h_proposal_data;
+ dr.h_contract_terms = h_contract_terms;
TALER_JSON_hash (wire,
&dr.h_wire);
dr.timestamp = GNUNET_TIME_absolute_hton (timestamp);
@@ -2318,7 +2318,7 @@ interpreter_run (void *cls)
&amount,
wire_deadline,
wire,
- &h_proposal_data,
+ &h_contract_terms,
&coin_pub,
coin_pk_sig,
&coin_pk->key,
@@ -2510,9 +2510,9 @@ interpreter_run (void *cls)
case OC_DEPOSIT_WTID:
{
struct GNUNET_HashCode h_wire;
- struct GNUNET_HashCode h_proposal_data;
+ struct GNUNET_HashCode h_contract_terms;
json_t *wire;
- json_t *proposal_data;
+ json_t *contract_terms;
const struct Command *coin;
struct TALER_CoinSpendPublicKeyP coin_pub;
@@ -2532,18 +2532,18 @@ interpreter_run (void *cls)
TALER_JSON_hash (wire,
&h_wire);
json_decref (wire);
- proposal_data = json_loads (ref->details.deposit.proposal_data,
+ contract_terms = json_loads (ref->details.deposit.contract_terms,
JSON_REJECT_DUPLICATES,
NULL);
- GNUNET_assert (NULL != proposal_data);
- TALER_JSON_hash (proposal_data,
- &h_proposal_data);
- json_decref (proposal_data);
+ GNUNET_assert (NULL != contract_terms);
+ TALER_JSON_hash (contract_terms,
+ &h_contract_terms);
+ json_decref (contract_terms);
cmd->details.deposit_wtid.dwh
= TALER_EXCHANGE_track_transaction (exchange,
&ref->details.deposit.merchant_priv,
&h_wire,
- &h_proposal_data,
+ &h_contract_terms,
&coin_pub,
&deposit_wtid_cb,
is);
@@ -2618,8 +2618,8 @@ interpreter_run (void *cls)
case OC_REFUND:
{
const struct Command *coin;
- struct GNUNET_HashCode h_proposal_data;
- json_t *proposal_data;
+ struct GNUNET_HashCode h_contract_terms;
+ json_t *contract_terms;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_Amount refund_fee;
@@ -2648,13 +2648,13 @@ interpreter_run (void *cls)
ref = find_command (is,
cmd->details.refund.deposit_ref);
GNUNET_assert (NULL != ref);
- proposal_data = json_loads (ref->details.deposit.proposal_data,
+ contract_terms = json_loads (ref->details.deposit.contract_terms,
JSON_REJECT_DUPLICATES,
NULL);
- GNUNET_assert (NULL != proposal_data);
- TALER_JSON_hash (proposal_data,
- &h_proposal_data);
- json_decref (proposal_data);
+ GNUNET_assert (NULL != contract_terms);
+ TALER_JSON_hash (contract_terms,
+ &h_contract_terms);
+ json_decref (contract_terms);
coin = find_command (is,
ref->details.deposit.coin_ref);
@@ -2666,7 +2666,7 @@ interpreter_run (void *cls)
= TALER_EXCHANGE_refund (exchange,
&amount,
&refund_fee,
- &h_proposal_data,
+ &h_contract_terms,
&coin_pub,
cmd->details.refund.rtransaction_id,
&ref->details.deposit.merchant_priv,
@@ -3147,7 +3147,7 @@ run (void *cls)
.details.deposit.amount = "EUR:5",
.details.deposit.coin_ref = "withdraw-coin-1",
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42 }",
- .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }" },
+ .details.deposit.contract_terms = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }" },
/* Try to overdraw funds ... */
{ .oc = OC_WITHDRAW_SIGN,
@@ -3163,7 +3163,7 @@ run (void *cls)
.details.deposit.amount = "EUR:5",
.details.deposit.coin_ref = "withdraw-coin-1",
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":43 }",
- .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }" },
+ .details.deposit.contract_terms = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }" },
/* Try to double-spend the 5 EUR coin at the same merchant (but different
transaction ID) */
{ .oc = OC_DEPOSIT,
@@ -3172,7 +3172,7 @@ run (void *cls)
.details.deposit.amount = "EUR:5",
.details.deposit.coin_ref = "withdraw-coin-1",
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42 }",
- .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }" },
+ .details.deposit.contract_terms = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }" },
/* Try to double-spend the 5 EUR coin at the same merchant (but different
proposal) */
{ .oc = OC_DEPOSIT,
@@ -3181,7 +3181,7 @@ run (void *cls)
.details.deposit.amount = "EUR:5",
.details.deposit.coin_ref = "withdraw-coin-1",
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42 }",
- .details.deposit.proposal_data = "{ \"items\":[{ \"name\":\"ice cream\", \"value\":2 } ] }" },
+ .details.deposit.contract_terms = "{ \"items\":[{ \"name\":\"ice cream\", \"value\":2 } ] }" },
/* ***************** /refresh testing ******************** */
@@ -3206,7 +3206,7 @@ run (void *cls)
.details.deposit.amount = "EUR:1",
.details.deposit.coin_ref = "refresh-withdraw-coin-1",
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42 }",
- .details.deposit.proposal_data = "{ \"items\" : [ { \"name\":\"ice cream\", \"value\":\"EUR:1\" } ] }" },
+ .details.deposit.contract_terms = "{ \"items\" : [ { \"name\":\"ice cream\", \"value\":\"EUR:1\" } ] }" },
/* Melt the rest of the coin's value (EUR:4.00 = 3x EUR:1.03 + 7x EUR:0.13) */
@@ -3247,7 +3247,7 @@ run (void *cls)
.details.deposit.coin_ref = "refresh-reveal-1-idempotency",
.details.deposit.coin_idx = 0,
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42 }",
- .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":3 } ] }" },
+ .details.deposit.contract_terms = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":3 } ] }" },
/* Test successfully spending coins from the refresh operation:
finally EUR:0.1 */
@@ -3258,7 +3258,7 @@ run (void *cls)
.details.deposit.coin_ref = "refresh-reveal-1",
.details.deposit.coin_idx = 4,
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":43 }",
- .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":3 } ] }" },
+ .details.deposit.contract_terms = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":3 } ] }" },
/* Test running a failing melt operation (same operation again must fail) */
{ .oc = OC_REFRESH_MELT,
@@ -3379,7 +3379,7 @@ run (void *cls)
.details.deposit.amount = "EUR:5",
.details.deposit.coin_ref = "withdraw-coin-r1",
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42 }",
- .details.deposit.proposal_data = "{ \"items\" : [ { \"name\":\"ice cream\", \"value\":\"EUR:5\" } ] }",
+ .details.deposit.contract_terms = "{ \"items\" : [ { \"name\":\"ice cream\", \"value\":\"EUR:5\" } ] }",
.details.deposit.refund_deadline = { 60LL * 1000 * 1000 } /* 60 s */,
},
/* Run transfers. Should do nothing as refund deadline blocks it */
@@ -3404,7 +3404,7 @@ run (void *cls)
.details.deposit.amount = "EUR:4.99",
.details.deposit.coin_ref = "withdraw-coin-r1",
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42 }",
- .details.deposit.proposal_data = "{ \"items\" : [ { \"name\":\"more ice cream\", \"value\":\"EUR:5\" } ] }",
+ .details.deposit.contract_terms = "{ \"items\" : [ { \"name\":\"more ice cream\", \"value\":\"EUR:5\" } ] }",
},
/* Run transfers. This will do the transfer as refund deadline was 0 */
{ .oc = OC_RUN_AGGREGATOR,
@@ -3491,7 +3491,7 @@ run (void *cls)
.details.deposit.amount = "EUR:0.5",
.details.deposit.coin_ref = "payback-withdraw-coin-2a",
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42 }",
- .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"more ice cream\", \"value\":1 } ] }" },
+ .details.deposit.contract_terms = "{ \"items\": [ { \"name\":\"more ice cream\", \"value\":1 } ] }" },
{ .oc = OC_REVOKE,
.label = "revoke-2",
.expected_response_code = MHD_HTTP_OK,
@@ -3512,7 +3512,7 @@ run (void *cls)
.details.deposit.amount = "EUR:1",
.details.deposit.coin_ref = "payback-withdraw-coin-2b",
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42 }",
- .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"more ice cream\", \"value\":1 } ] }" },
+ .details.deposit.contract_terms = "{ \"items\": [ { \"name\":\"more ice cream\", \"value\":1 } ] }" },
/* Test deposit fails after payback, with proof in payback */
/* FIXME: #3887: right now, the exchange will never return the
@@ -3523,7 +3523,7 @@ run (void *cls)
.details.deposit.amount = "EUR:0.5",
.details.deposit.coin_ref = "payback-withdraw-coin-2a",
.details.deposit.wire_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42 }",
- .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"extra ice cream\", \"value\":1 } ] }" },
+ .details.deposit.contract_terms = "{ \"items\": [ { \"name\":\"extra ice cream\", \"value\":1 } ] }" },
/* Test that revoked coins cannot be withdrawn */