summaryrefslogtreecommitdiff
path: root/src/exchange-lib
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-02-06 15:41:39 +0100
committerFlorian Dold <florian.dold@gmail.com>2017-02-06 15:43:06 +0100
commit8c820b6916841d746475a4f67904272a518a7aa9 (patch)
tree947ac506f58d92990a7a2dfcfd4a1b7ed9ead48b /src/exchange-lib
parent26d5e08816d3a435cb562db5859069206ca95a63 (diff)
downloadexchange-8c820b6916841d746475a4f67904272a518a7aa9.tar.gz
exchange-8c820b6916841d746475a4f67904272a518a7aa9.tar.bz2
exchange-8c820b6916841d746475a4f67904272a518a7aa9.zip
contract terminology renaming (#4877)
Diffstat (limited to 'src/exchange-lib')
-rw-r--r--src/exchange-lib/baseline/deposit.req2
-rw-r--r--src/exchange-lib/exchange_api_common.c2
-rw-r--r--src/exchange-lib/exchange_api_deposit.c22
-rw-r--r--src/exchange-lib/exchange_api_refund.c14
-rw-r--r--src/exchange-lib/exchange_api_track_transaction.c13
-rw-r--r--src/exchange-lib/exchange_api_track_transfer.c4
-rw-r--r--src/exchange-lib/test_exchange_api.c80
7 files changed, 69 insertions, 68 deletions
diff --git a/src/exchange-lib/baseline/deposit.req b/src/exchange-lib/baseline/deposit.req
index f50d83e40..3cf6e4ac0 100644
--- a/src/exchange-lib/baseline/deposit.req
+++ b/src/exchange-lib/baseline/deposit.req
@@ -5,4 +5,4 @@ Content-Type: application/json
Content-Length: 1658
Expect: 100-continue
-{"ub_sig":"51SPJSSDESGPR80A40M74WV140520818ECG26E9M8S0M6CSH6X334GSN8RW30D9G8MT46CA660W34GSG6MT4AD9K8GT3ECSH6MVK0E2374V38H1M8MR4CDJ66MWK4E1S6MR3GCT28CV32H1Q8N23GCHG70S36C1K8MS3GCSN8RV36D9S710KGD9K6GWKEGJ28GRM4CJ56X1K6DJ18D2KGHA46D13GDA66GVK4GHJ8N13AE9J8RVK6GT184S48E1K6X336G9Q8N142CJ4692M6EA16GRKJD9N6523ADA36X13GG9G70TK6DHN68R36CT18GR4CDSJ6CW3GCT364W46CSR8RV42GJ474SMADSH851K4H9Q8GS42CHS8RV3GCSJ64V46DSN8RSM6HHN6N246D9S6934AH9P6X23JGSH652K0DJ5612KJGA26N242CH35452081918G2J2G0","timestamp":"/Date(1442821652)/","f":{"currency":"EUR","value":5,"fraction":0},"wire":{"type":"TEST","bank":"dest bank","account":42},"coin_pub":"JXWK4NS0H2W4V4BETQ90CCEDADP6QQ3MV3YZ7RV2KXEM8PWXE8Q0","H_wire":"YQED9FDYPKK2QQYB3FS19Y15ZMKBAXJP2C73CXASAF1KM6ZYY723TEJ3HBR6D864A7X5W58G92QJ0A9PFMZNB81ZP9NJAQQCCABM4RG","H_contract":"1CMEEFQ5S4QJGGAMVYFV07XQRHQA311CR2MTRNC5M9KZV6ETDV1SY00WJFEV2CG9BXQTEQPZAF8A54C2HX32TZCN20VBGPFPS2Z16B0","merchant_pub":"C36TEXQXFW00170C2EJ66ZR0000CX9VPZNZG00109NX020000000","denom_pub":"51R7ARKCD5HJTTV5F4G0M818E9SP280A40G2GVH04CR30GT58S2K2HJ16H336C9N8CVK4E9N6H1MADHH61330HHM6N1K8E1H8RVKJH256D1M6E1K8RWKJGSH8S2M6DJ170TK2H266GTK8DSS64RKJDJ26D144DJ474SK0GHQ711MAD9G752M2CJ58S1KJDA570SK2E9G8N23GCJ28S146DHH610K2H1Q8CW3GGA16S146H9G68TKACSQ6914CE1H691K2E9N6RWM8H9P8CWM2H9S8GSK0H9P6D1K6H9G6X0M4C2171144HJ46N334H9J692M4H9M8MR4CCJ46GRKEGA46533CDJ38MV4CH9K892MAH1P8S2K6D9K6N246E256H244G9Q6D346GJ56S23JGHJ690KADHJ8H242H2575132CSM6X1M4G9N6RR48E9H8MVM8E9354520818CMG26C1H60R30C935452081918G2J2G0","transaction_id":1,"refund_deadline":"/Date(0)/","coin_sig":"X16E0DP8C2BJNVNX09G24FFC5GA4W7RN2YXZP9WJTAN9BY6B4GMA39QNYR51XNNEZ3H1J7TP0K9G55JZ8V7WS7CZMD7E64HWYBFWM00"} \ No newline at end of file
+{"ub_sig":"51SPJSSDESGPR80A40M74WV140520818ECG26E9M8S0M6CSH6X334GSN8RW30D9G8MT46CA660W34GSG6MT4AD9K8GT3ECSH6MVK0E2374V38H1M8MR4CDJ66MWK4E1S6MR3GCT28CV32H1Q8N23GCHG70S36C1K8MS3GCSN8RV36D9S710KGD9K6GWKEGJ28GRM4CJ56X1K6DJ18D2KGHA46D13GDA66GVK4GHJ8N13AE9J8RVK6GT184S48E1K6X336G9Q8N142CJ4692M6EA16GRKJD9N6523ADA36X13GG9G70TK6DHN68R36CT18GR4CDSJ6CW3GCT364W46CSR8RV42GJ474SMADSH851K4H9Q8GS42CHS8RV3GCSJ64V46DSN8RSM6HHN6N246D9S6934AH9P6X23JGSH652K0DJ5612KJGA26N242CH35452081918G2J2G0","timestamp":"/Date(1442821652)/","f":{"currency":"EUR","value":5,"fraction":0},"wire":{"type":"TEST","bank":"dest bank","account":42},"coin_pub":"JXWK4NS0H2W4V4BETQ90CCEDADP6QQ3MV3YZ7RV2KXEM8PWXE8Q0","H_wire":"YQED9FDYPKK2QQYB3FS19Y15ZMKBAXJP2C73CXASAF1KM6ZYY723TEJ3HBR6D864A7X5W58G92QJ0A9PFMZNB81ZP9NJAQQCCABM4RG","h_proposal_data":"1CMEEFQ5S4QJGGAMVYFV07XQRHQA311CR2MTRNC5M9KZV6ETDV1SY00WJFEV2CG9BXQTEQPZAF8A54C2HX32TZCN20VBGPFPS2Z16B0","merchant_pub":"C36TEXQXFW00170C2EJ66ZR0000CX9VPZNZG00109NX020000000","denom_pub":"51R7ARKCD5HJTTV5F4G0M818E9SP280A40G2GVH04CR30GT58S2K2HJ16H336C9N8CVK4E9N6H1MADHH61330HHM6N1K8E1H8RVKJH256D1M6E1K8RWKJGSH8S2M6DJ170TK2H266GTK8DSS64RKJDJ26D144DJ474SK0GHQ711MAD9G752M2CJ58S1KJDA570SK2E9G8N23GCJ28S146DHH610K2H1Q8CW3GGA16S146H9G68TKACSQ6914CE1H691K2E9N6RWM8H9P8CWM2H9S8GSK0H9P6D1K6H9G6X0M4C2171144HJ46N334H9J692M4H9M8MR4CCJ46GRKEGA46533CDJ38MV4CH9K892MAH1P8S2K6D9K6N246E256H244G9Q6D346GJ56S23JGHJ690KADHJ8H242H2575132CSM6X1M4G9N6RR48E9H8MVM8E9354520818CMG26C1H60R30C935452081918G2J2G0","transaction_id":1,"refund_deadline":"/Date(0)/","coin_sig":"X16E0DP8C2BJNVNX09G24FFC5GA4W7RN2YXZP9WJTAN9BY6B4GMA39QNYR51XNNEZ3H1J7TP0K9G55JZ8V7WS7CZMD7E64HWYBFWM00"} \ No newline at end of file
diff --git a/src/exchange-lib/exchange_api_common.c b/src/exchange-lib/exchange_api_common.c
index a531b1c39..0d1110bd4 100644
--- a/src/exchange-lib/exchange_api_common.c
+++ b/src/exchange-lib/exchange_api_common.c
@@ -226,7 +226,7 @@ TALER_EXCHANGE_verify_coin_history (const char *currency,
return GNUNET_SYSERR;
}
/* NOTE/FIXME: theoretically, we could also check that the given
- transaction_id and merchant_pub and h_contract appear in the
+ transaction_id and merchant_pub and h_proposal_data appear in the
history under deposits. However, there is really no benefit
for the exchange to lie here, so not checking is probably OK
(an auditor ought to check, though). Then again, we similarly
diff --git a/src/exchange-lib/exchange_api_deposit.c b/src/exchange-lib/exchange_api_deposit.c
index 9282bbfd1..1fc9af6fd 100644
--- a/src/exchange-lib/exchange_api_deposit.c
+++ b/src/exchange-lib/exchange_api_deposit.c
@@ -274,11 +274,11 @@ handle_deposit_finished (void *cls,
* @param dki public key information
* @param amount the amount to be deposited
* @param h_wire hash of the merchant’s account details
- * @param h_contract hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
+ * @param h_proposal_data hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
* @param coin_pub coin’s public key
* @param denom_pub denomination key with which the coin is signed
* @param denom_sig exchange’s unblinded signature of the coin
- * @param timestamp timestamp when the contract was finalized, must match approximately the current time of the exchange
+ * @param timestamp timestamp when the deposit was finalized
* @param transaction_id transaction id for the transaction between merchant and customer
* @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests)
* @param refund_deadline date until which the merchant can issue a refund to the customer via the exchange (can be zero if refunds are not allowed)
@@ -289,7 +289,7 @@ static int
verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
const struct TALER_Amount *amount,
const struct GNUNET_HashCode *h_wire,
- const struct GNUNET_HashCode *h_contract,
+ const struct GNUNET_HashCode *h_proposal_data,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub,
@@ -304,7 +304,7 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT);
dr.purpose.size = htonl (sizeof (struct TALER_DepositRequestPS));
- dr.h_contract = *h_contract;
+ dr.h_proposal_data = *h_proposal_data;
dr.h_wire = *h_wire;
dr.timestamp = GNUNET_TIME_absolute_hton (timestamp);
dr.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline);
@@ -374,11 +374,11 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
* @param wire_deadline date until which the merchant would like the exchange to settle the balance (advisory, the exchange cannot be
* forced to settle in the past or upon very short notice, but of course a well-behaved exchange will limit aggregation based on the advice received)
* @param wire_details the merchant’s account details, in a format supported by the exchange
- * @param h_contract hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
+ * @param h_proposal_data hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
* @param coin_pub coin’s public key
* @param denom_pub denomination key with which the coin is signed
* @param denom_sig exchange’s unblinded signature of the coin
- * @param timestamp timestamp when the contract was finalized, must match approximately the current time of the exchange
+ * @param timestamp timestamp when the contract was finalized, must not be too far in the future
* @param transaction_id transaction id for the transaction between merchant and customer
* @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests)
* @param refund_deadline date until which the merchant can issue a refund to the customer via the exchange (can be zero if refunds are not allowed); must not be after the @a wire_deadline
@@ -393,7 +393,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount,
struct GNUNET_TIME_Absolute wire_deadline,
json_t *wire_details,
- const struct GNUNET_HashCode *h_contract,
+ const struct GNUNET_HashCode *h_proposal_data,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub,
@@ -435,7 +435,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
verify_signatures (dki,
amount,
&h_wire,
- h_contract,
+ h_proposal_data,
coin_pub,
denom_sig,
denom_pub,
@@ -450,7 +450,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
}
deposit_obj = json_pack ("{s:o, s:O," /* f/wire */
- " s:o, s:o," /* H_wire, H_contract */
+ " s:o, s:o," /* H_wire, h_proposal_data */
" s:o, s:o," /* coin_pub, denom_pub */
" s:o, s:o," /* ub_sig, timestamp */
" s:I, s:o," /* transaction id, merchant_pub */
@@ -459,7 +459,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
"f", TALER_JSON_from_amount (amount),
"wire", wire_details,
"H_wire", GNUNET_JSON_from_data_auto (&h_wire),
- "H_contract", GNUNET_JSON_from_data_auto (h_contract),
+ "h_proposal_data", GNUNET_JSON_from_data_auto (h_proposal_data),
"coin_pub", GNUNET_JSON_from_data_auto (coin_pub),
"denom_pub", GNUNET_JSON_from_rsa_public_key (denom_pub->rsa_public_key),
"ub_sig", GNUNET_JSON_from_rsa_signature (denom_sig->rsa_signature),
@@ -478,7 +478,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
dh->url = MAH_path_to_url (exchange, "/deposit");
dh->depconf.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationPS));
dh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT);
- dh->depconf.h_contract = *h_contract;
+ dh->depconf.h_proposal_data = *h_proposal_data;
dh->depconf.h_wire = h_wire;
dh->depconf.transaction_id = GNUNET_htonll (transaction_id);
dh->depconf.timestamp = GNUNET_TIME_absolute_hton (timestamp);
diff --git a/src/exchange-lib/exchange_api_refund.c b/src/exchange-lib/exchange_api_refund.c
index be080c57b..3f08e1597 100644
--- a/src/exchange-lib/exchange_api_refund.c
+++ b/src/exchange-lib/exchange_api_refund.c
@@ -220,8 +220,8 @@ handle_refund_finished (void *cls,
* (as that fee is still being subtracted), and smaller than the amount
* (with deposit fee) of the original deposit contribution of this coin
* @param refund_fee fee applicable to this coin for the refund
- * @param h_contract hash of the contact of the merchant with the customer that is being refunded
- * @param transaction_id transaction id for the transaction being refunded, must match @a h_contract
+ * @param h_proposal_data hash of the contact of the merchant with the customer that is being refunded
+ * @param transaction_id transaction id for the transaction being refunded, must match @a h_proposal_data
* @param coin_pub coin’s public key of the coin from the original deposit operation
* @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation);
* this is needed as we may first do a partial refund and later a full refund. If both
@@ -237,7 +237,7 @@ struct TALER_EXCHANGE_RefundHandle *
TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount,
const struct TALER_Amount *refund_fee,
- const struct GNUNET_HashCode *h_contract,
+ const struct GNUNET_HashCode *h_proposal_data,
uint64_t transaction_id,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
uint64_t rtransaction_id,
@@ -256,7 +256,7 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
MAH_handle_is_ready (exchange));
rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND);
rr.purpose.size = htonl (sizeof (struct TALER_RefundRequestPS));
- rr.h_contract = *h_contract;
+ rr.h_proposal_data = *h_proposal_data;
rr.transaction_id = GNUNET_htonll (transaction_id);
rr.coin_pub = *coin_pub;
GNUNET_CRYPTO_eddsa_key_get_public (&merchant_priv->eddsa_priv,
@@ -271,12 +271,12 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
&rr.purpose,
&merchant_sig.eddsa_sig));
refund_obj = json_pack ("{s:o, s:o," /* amount/fee */
- " s:o, s:o," /* H_contract, coin_pub */
+ " s:o, s:o," /* h_proposal_data, coin_pub */
" s:I, s:I," /* transaction id, rtransaction id */
" s:o, s:o}", /* merchant_pub, merchant_sig */
"refund_amount", TALER_JSON_from_amount (amount),
"refund_fee", TALER_JSON_from_amount (refund_fee),
- "H_contract", GNUNET_JSON_from_data_auto (h_contract),
+ "h_proposal_data", GNUNET_JSON_from_data_auto (h_proposal_data),
"coin_pub", GNUNET_JSON_from_data_auto (coin_pub),
"transaction_id", (json_int_t) transaction_id,
"rtransaction_id", (json_int_t) rtransaction_id,
@@ -292,7 +292,7 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
rh->url = MAH_path_to_url (exchange, "/refund");
rh->depconf.purpose.size = htonl (sizeof (struct TALER_RefundConfirmationPS));
rh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND);
- rh->depconf.h_contract = *h_contract;
+ rh->depconf.h_proposal_data = *h_proposal_data;
rh->depconf.transaction_id = GNUNET_htonll (transaction_id);
rh->depconf.coin_pub = *coin_pub;
rh->depconf.merchant = rr.merchant;
diff --git a/src/exchange-lib/exchange_api_track_transaction.c b/src/exchange-lib/exchange_api_track_transaction.c
index 7fd2efb21..c40f2174e 100644
--- a/src/exchange-lib/exchange_api_track_transaction.c
+++ b/src/exchange-lib/exchange_api_track_transaction.c
@@ -254,7 +254,8 @@ handle_deposit_wtid_finished (void *cls,
* @param exchange the exchange to query
* @param merchant_priv the merchant's private key
* @param h_wire hash of merchant's wire transfer details
- * @param h_contract hash of the contract
+ * @param h_proposal_data hash of the proposal data from the contract
+ * between merchant and customer
* @param coin_pub public key of the coin
* @param transaction_id transaction identifier
* @param cb function to call with the result
@@ -265,7 +266,7 @@ struct TALER_EXCHANGE_TrackTransactionHandle *
TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_MerchantPrivateKeyP *merchant_priv,
const struct GNUNET_HashCode *h_wire,
- const struct GNUNET_HashCode *h_contract,
+ const struct GNUNET_HashCode *h_proposal_data,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
uint64_t transaction_id,
TALER_EXCHANGE_TrackTransactionCallback cb,
@@ -286,7 +287,7 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange,
}
dtp.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION);
dtp.purpose.size = htonl (sizeof (dtp));
- dtp.h_contract = *h_contract;
+ dtp.h_proposal_data = *h_proposal_data;
dtp.h_wire = *h_wire;
dtp.transaction_id = GNUNET_htonll (transaction_id);
GNUNET_CRYPTO_eddsa_key_get_public (&merchant_priv->eddsa_priv,
@@ -297,11 +298,11 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange,
GNUNET_CRYPTO_eddsa_sign (&merchant_priv->eddsa_priv,
&dtp.purpose,
&merchant_sig.eddsa_sig));
- deposit_wtid_obj = json_pack ("{s:o, s:o," /* H_wire, H_contract */
+ deposit_wtid_obj = json_pack ("{s:o, s:o," /* H_wire, h_proposal_data */
" s:o, s:I," /* coin_pub, transaction_id */
" s:o, s:o}", /* merchant_pub, merchant_sig */
"H_wire", GNUNET_JSON_from_data_auto (h_wire),
- "H_contract", GNUNET_JSON_from_data_auto (h_contract),
+ "h_proposal_data", GNUNET_JSON_from_data_auto (h_proposal_data),
"coin_pub", GNUNET_JSON_from_data_auto (coin_pub),
"transaction_id", (json_int_t) transaction_id,
"merchant_pub", GNUNET_JSON_from_data_auto (&dtp.merchant),
@@ -315,7 +316,7 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange,
dwh->depconf.purpose.size = htonl (sizeof (struct TALER_ConfirmWirePS));
dwh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE);
dwh->depconf.h_wire = *h_wire;
- dwh->depconf.h_contract = *h_contract;
+ dwh->depconf.h_proposal_data = *h_proposal_data;
dwh->depconf.coin_pub = *coin_pub;
dwh->depconf.transaction_id = GNUNET_htonll (transaction_id);
diff --git a/src/exchange-lib/exchange_api_track_transfer.c b/src/exchange-lib/exchange_api_track_transfer.c
index 8ed5865d7..89206e235 100644
--- a/src/exchange-lib/exchange_api_track_transfer.c
+++ b/src/exchange-lib/exchange_api_track_transfer.c
@@ -124,7 +124,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh
struct TALER_TrackTransferDetails *detail = &details[i];
struct json_t *detail_j = json_array_get (details_j, i);
struct GNUNET_JSON_Specification spec_detail[] = {
- GNUNET_JSON_spec_fixed_auto ("H_contract", &detail->h_contract),
+ GNUNET_JSON_spec_fixed_auto ("h_proposal_data", &detail->h_proposal_data),
GNUNET_JSON_spec_uint64 ("transaction_id", &detail->transaction_id),
GNUNET_JSON_spec_fixed_auto ("coin_pub", &detail->coin_pub),
TALER_JSON_spec_amount ("deposit_value", &detail->coin_value),
@@ -143,7 +143,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh
return GNUNET_SYSERR;
}
/* build up big hash for signature checking later */
- dd.h_contract = detail->h_contract;
+ dd.h_proposal_data = detail->h_proposal_data;
dd.execution_time = GNUNET_TIME_absolute_hton (exec_time);
dd.transaction_id = GNUNET_htonll (detail->transaction_id);
dd.coin_pub = detail->coin_pub;
diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c
index 289c88741..d15459e4d 100644
--- a/src/exchange-lib/test_exchange_api.c
+++ b/src/exchange-lib/test_exchange_api.c
@@ -371,9 +371,9 @@ struct Command
const char *wire_details;
/**
- * JSON string describing the contract between the two parties.
+ * JSON string describing what a proposal is about.
*/
- const char *contract;
+ const char *proposal_data;
/**
* Transaction ID to use.
@@ -630,7 +630,7 @@ struct Command
/**
* Reference to the corresponding deposit operation.
- * Used to obtain contract details, merchant keys,
+ * Used to obtain proposal details, merchant keys,
* fee structure, etc.
*/
const char *deposit_ref;
@@ -1874,7 +1874,7 @@ interpreter_run (void *cls)
return;
case OC_DEPOSIT:
{
- struct GNUNET_HashCode h_contract;
+ struct GNUNET_HashCode h_proposal_data;
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
const struct TALER_EXCHANGE_DenomPublicKey *coin_pk;
const struct TALER_DenominationSignature *coin_pk_sig;
@@ -1885,7 +1885,7 @@ interpreter_run (void *cls)
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
struct TALER_MerchantPublicKeyP merchant_pub;
- json_t *contract;
+ json_t *proposal_data;
json_t *wire;
GNUNET_assert (NULL !=
@@ -1928,22 +1928,22 @@ interpreter_run (void *cls)
fail (is);
return;
}
- contract = json_loads (cmd->details.deposit.contract,
+ proposal_data = json_loads (cmd->details.deposit.proposal_data,
JSON_REJECT_DUPLICATES,
NULL);
- if (NULL == contract)
+ if (NULL == proposal_data)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to parse contract details `%s' at %u/%s\n",
- cmd->details.deposit.contract,
+ "Failed to parse proposal data `%s' at %u/%s\n",
+ cmd->details.deposit.proposal_data,
is->ip,
cmd->label);
fail (is);
return;
}
- TALER_JSON_hash (contract,
- &h_contract);
- json_decref (contract);
+ TALER_JSON_hash (proposal_data,
+ &h_proposal_data);
+ json_decref (proposal_data);
wire = json_loads (cmd->details.deposit.wire_details,
JSON_REJECT_DUPLICATES,
NULL);
@@ -1986,7 +1986,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_contract = h_contract;
+ dr.h_proposal_data = h_proposal_data;
TALER_JSON_hash (wire,
&dr.h_wire);
dr.timestamp = GNUNET_TIME_absolute_hton (timestamp);
@@ -2008,7 +2008,7 @@ interpreter_run (void *cls)
&amount,
wire_deadline,
wire,
- &h_contract,
+ &h_proposal_data,
&coin_pub,
coin_pk_sig,
&coin_pk->key,
@@ -2201,9 +2201,9 @@ interpreter_run (void *cls)
case OC_DEPOSIT_WTID:
{
struct GNUNET_HashCode h_wire;
- struct GNUNET_HashCode h_contract;
+ struct GNUNET_HashCode h_proposal_data;
json_t *wire;
- json_t *contract;
+ json_t *proposal_data;
const struct Command *coin;
struct TALER_CoinSpendPublicKeyP coin_pub;
@@ -2223,18 +2223,18 @@ interpreter_run (void *cls)
TALER_JSON_hash (wire,
&h_wire);
json_decref (wire);
- contract = json_loads (ref->details.deposit.contract,
+ proposal_data = json_loads (ref->details.deposit.proposal_data,
JSON_REJECT_DUPLICATES,
NULL);
- GNUNET_assert (NULL != contract);
- TALER_JSON_hash (contract,
- &h_contract);
- json_decref (contract);
+ GNUNET_assert (NULL != proposal_data);
+ TALER_JSON_hash (proposal_data,
+ &h_proposal_data);
+ json_decref (proposal_data);
cmd->details.deposit_wtid.dwh
= TALER_EXCHANGE_track_transaction (exchange,
&ref->details.deposit.merchant_priv,
&h_wire,
- &h_contract,
+ &h_proposal_data,
&coin_pub,
ref->details.deposit.transaction_id,
&deposit_wtid_cb,
@@ -2309,8 +2309,8 @@ interpreter_run (void *cls)
case OC_REFUND:
{
const struct Command *coin;
- struct GNUNET_HashCode h_contract;
- json_t *contract;
+ struct GNUNET_HashCode h_proposal_data;
+ json_t *proposal_data;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_Amount refund_fee;
@@ -2339,13 +2339,13 @@ interpreter_run (void *cls)
ref = find_command (is,
cmd->details.refund.deposit_ref);
GNUNET_assert (NULL != ref);
- contract = json_loads (ref->details.deposit.contract,
+ proposal_data = json_loads (ref->details.deposit.proposal_data,
JSON_REJECT_DUPLICATES,
NULL);
- GNUNET_assert (NULL != contract);
- TALER_JSON_hash (contract,
- &h_contract);
- json_decref (contract);
+ GNUNET_assert (NULL != proposal_data);
+ TALER_JSON_hash (proposal_data,
+ &h_proposal_data);
+ json_decref (proposal_data);
coin = find_command (is,
ref->details.deposit.coin_ref);
@@ -2357,7 +2357,7 @@ interpreter_run (void *cls)
= TALER_EXCHANGE_refund (exchange,
&amount,
&refund_fee,
- &h_contract,
+ &h_proposal_data,
ref->details.deposit.transaction_id,
&coin_pub,
cmd->details.refund.rtransaction_id,
@@ -2761,7 +2761,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.contract = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }",
+ .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }",
.details.deposit.transaction_id = 1 },
/* Try to overdraw funds ... */
@@ -2778,7 +2778,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.contract = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }",
+ .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }",
.details.deposit.transaction_id = 1 },
/* Try to double-spend the 5 EUR coin at the same merchant (but different
transaction ID) */
@@ -2788,17 +2788,17 @@ 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.contract = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }",
+ .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":1 } ] }",
.details.deposit.transaction_id = 2 },
/* Try to double-spend the 5 EUR coin at the same merchant (but different
- contract) */
+ proposal) */
{ .oc = OC_DEPOSIT,
.label = "deposit-double-3",
.expected_response_code = MHD_HTTP_FORBIDDEN,
.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.contract = "{ \"items\":[{ \"name\":\"ice cream\", \"value\":2 } ] }",
+ .details.deposit.proposal_data = "{ \"items\":[{ \"name\":\"ice cream\", \"value\":2 } ] }",
.details.deposit.transaction_id = 1 },
/* ***************** /refresh testing ******************** */
@@ -2824,7 +2824,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.contract = "{ \"items\" : [ { \"name\":\"ice cream\", \"value\":\"EUR:1\" } ] }",
+ .details.deposit.proposal_data = "{ \"items\" : [ { \"name\":\"ice cream\", \"value\":\"EUR:1\" } ] }",
.details.deposit.transaction_id = 42421 },
/* Melt the rest of the coin's value (EUR:4.00 = 3x EUR:1.03 + 7x EUR:0.13) */
@@ -2866,7 +2866,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.contract = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":3 } ] }",
+ .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":3 } ] }",
.details.deposit.transaction_id = 2 },
/* Test successfully spending coins from the refresh operation:
@@ -2878,7 +2878,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.contract = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":3 } ] }",
+ .details.deposit.proposal_data = "{ \"items\": [ { \"name\":\"ice cream\", \"value\":3 } ] }",
.details.deposit.transaction_id = 2 },
/* Test running a failing melt operation (same operation again must fail) */
@@ -2994,7 +2994,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.contract = "{ \"items\" : [ { \"name\":\"ice cream\", \"value\":\"EUR:5\" } ] }",
+ .details.deposit.proposal_data = "{ \"items\" : [ { \"name\":\"ice cream\", \"value\":\"EUR:5\" } ] }",
.details.deposit.transaction_id = 424210,
.details.deposit.refund_deadline = { 60LL * 1000 * 1000 } /* 60 s */,
},
@@ -3021,7 +3021,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.contract = "{ \"items\" : [ { \"name\":\"more ice cream\", \"value\":\"EUR:5\" } ] }",
+ .details.deposit.proposal_data = "{ \"items\" : [ { \"name\":\"more ice cream\", \"value\":\"EUR:5\" } ] }",
.details.deposit.transaction_id = 424211,
},
/* Run transfers. This will do the transfer as refund deadline was 0 */