From a0536b3b637a1ba6109f9f4b3a3b04a7763582fb Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 29 May 2017 01:18:14 +0200 Subject: rename proposal_data to contract_terms (see #4879) --- doc/Makefile.am | 2 +- src/backend/taler-merchant-httpd_history.c | 10 +- src/backend/taler-merchant-httpd_pay.c | 80 +++---- src/backend/taler-merchant-httpd_proposal.c | 10 +- .../taler-merchant-httpd_track-transaction.c | 44 ++-- src/backend/taler-merchant-httpd_track-transfer.c | 24 +- src/backenddb/plugin_merchantdb_postgres.c | 266 ++++++++++----------- src/backenddb/test_merchantdb.c | 74 +++--- src/include/taler_merchant_service.h | 6 +- src/include/taler_merchantdb_plugin.h | 98 ++++---- src/lib/merchant_api_pay.c | 6 +- src/lib/merchant_api_proposal.c | 12 +- src/lib/test_merchant_api.c | 30 +-- .../taler-merchant-generate-payments.c | 26 +- 14 files changed, 344 insertions(+), 344 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index b233fa5c..86e8e653 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -3,7 +3,7 @@ all: manual.pdf manual.html manual.pdf: arch.pdf manual.texi texi2pdf manual.texi manual.html: arch.jpg manual.texi - texi2html manual.texi + makeinfo --html --no-split manual.texi arch.pdf: arch.dot dot -Tpdf arch.dot > arch.pdf arch.jpg: arch.dot diff --git a/src/backend/taler-merchant-httpd_history.c b/src/backend/taler-merchant-httpd_history.c index 315907a9..a06259cf 100644 --- a/src/backend/taler-merchant-httpd_history.c +++ b/src/backend/taler-merchant-httpd_history.c @@ -38,7 +38,7 @@ static void pd_cb (void *cls, const char *order_id, uint64_t row_id, - const json_t *proposal_data) + const json_t *contract_terms) { json_t *response = cls; json_t *entry; @@ -50,7 +50,7 @@ pd_cb (void *cls, "/history's row_id: %llu\n", (unsigned long long) row_id); - GNUNET_assert (-1 != json_unpack ((json_t *) proposal_data, + GNUNET_assert (-1 != json_unpack ((json_t *) contract_terms, "{s:o, s:o, s:{s:o}}", "amount", &amount, "timestamp", ×tamp, @@ -150,7 +150,7 @@ MH_handler_history (struct TMH_RequestHandler *rh, if (NULL != str) { - ret = db->find_proposal_data_history (db->cls, + ret = db->find_contract_terms_history (db->cls, str, &mi->pubkey, pd_cb, @@ -205,14 +205,14 @@ MH_handler_history (struct TMH_RequestHandler *rh, delta); if (0 > start) - ret = db->find_proposal_data_by_date (db->cls, + ret = db->find_contract_terms_by_date (db->cls, date, &mi->pubkey, delta, pd_cb, response); else - ret = db->find_proposal_data_by_date_and_range (db->cls, + ret = db->find_contract_terms_by_date_and_range (db->cls, date, &mi->pubkey, start, diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c index 307690ea..97b7ac4d 100644 --- a/src/backend/taler-merchant-httpd_pay.c +++ b/src/backend/taler-merchant-httpd_pay.c @@ -147,7 +147,7 @@ struct PayContext * Proposal data for the proposal that is being * payed for in this context. */ - json_t *proposal_data; + json_t *contract_terms; /** * Task called when the (suspended) processing for @@ -192,10 +192,10 @@ struct PayContext /** * Hashed proposal. */ - struct GNUNET_HashCode h_proposal_data; + struct GNUNET_HashCode h_contract_terms; /** - * "H_wire" from @e proposal_data. Used to identify the instance's + * "H_wire" from @e contract_terms. Used to identify the instance's * wire transfer method. */ struct GNUNET_HashCode h_wire; @@ -241,12 +241,12 @@ struct PayContext struct GNUNET_TIME_Absolute wire_transfer_deadline; /** - * Timestamp from @e proposal_data. + * Timestamp from @e contract_terms. */ struct GNUNET_TIME_Absolute timestamp; /** - * Refund deadline from @e proposal_data. + * Refund deadline from @e contract_terms. */ struct GNUNET_TIME_Absolute refund_deadline; @@ -401,19 +401,19 @@ sign_success_response (struct PayContext *pc) mr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_PAYMENT_OK); mr.purpose.size = htonl (sizeof (mr)); - mr.h_proposal_data = pc->h_proposal_data; + mr.h_contract_terms = pc->h_contract_terms; GNUNET_CRYPTO_eddsa_sign (&pc->mi->privkey.eddsa_priv, &mr.purpose, &sig); return TMH_RESPONSE_make_json_pack ("{s:O, s:o, s:o}", - "proposal_data", - pc->proposal_data, + "contract_terms", + pc->contract_terms, "sig", GNUNET_JSON_from_data_auto (&sig), - "h_proposal_data", - GNUNET_JSON_from_data (&pc->h_proposal_data, + "h_contract_terms", + GNUNET_JSON_from_data (&pc->h_contract_terms, sizeof (struct GNUNET_HashCode))); } @@ -486,12 +486,12 @@ deposit_cb (void *cls, } /* store result to DB */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Storing successful payment for h_proposal_data '%s'\n", - GNUNET_h2s (&pc->h_proposal_data)); + "Storing successful payment for h_contract_terms '%s'\n", + GNUNET_h2s (&pc->h_contract_terms)); if (GNUNET_OK != db->store_deposit (db->cls, - &pc->h_proposal_data, + &pc->h_contract_terms, &pc->mi->pubkey, &dc->coin_pub, &dc->amount_with_fee, @@ -570,10 +570,10 @@ pay_context_cleanup (struct TM_HandlerContext *hc) GNUNET_free (pc->chosen_exchange); pc->chosen_exchange = NULL; } - if (NULL != pc->proposal_data) + if (NULL != pc->contract_terms) { - json_decref (pc->proposal_data); - pc->proposal_data = NULL; + json_decref (pc->contract_terms); + pc->contract_terms = NULL; } GNUNET_CONTAINER_DLL_remove (pc_head, pc_tail, @@ -848,7 +848,7 @@ process_pay_with_exchange (void *cls, &dc->amount_with_fee, pc->wire_transfer_deadline, pc->mi->j_wire, - &pc->h_proposal_data, + &pc->h_contract_terms, &dc->coin_pub, &dc->ub_sig, &dc->denom, @@ -905,7 +905,7 @@ handle_pay_timeout (void *cls) * Function called with information about a coin that was deposited. * * @param cls closure - * @param h_proposal_data hashed proposal data + * @param h_contract_terms hashed proposal data * @param coin_pub public key of the coin * @param amount_with_fee amount the exchange will deposit for this coin * @param deposit_fee fee the exchange will charge for this coin @@ -913,7 +913,7 @@ handle_pay_timeout (void *cls) */ static void check_coin_paid (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *deposit_fee, @@ -922,8 +922,8 @@ check_coin_paid (void *cls, struct PayContext *pc = cls; unsigned int i; - if (0 != memcmp (&pc->h_proposal_data, - h_proposal_data, + if (0 != memcmp (&pc->h_contract_terms, + h_contract_terms, sizeof (struct GNUNET_HashCode))) { GNUNET_break (0); @@ -961,7 +961,7 @@ check_coin_paid (void *cls, * @param cls closure with the `struct PayContext` * @param merchant_pub merchant's public key * @param exchange_uri URI of the exchange - * @param h_proposal_data hashed proposal data + * @param h_contract_terms hashed proposal data * @param h_xwire hash of our wire details * @param timestamp time of the confirmation * @param refund refund deadline @@ -971,7 +971,7 @@ static void check_transaction_exists (void *cls, const struct TALER_MerchantPublicKeyP *merchant_pub, const char *exchange_uri, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct GNUNET_HashCode *h_xwire, struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute refund, @@ -979,8 +979,8 @@ check_transaction_exists (void *cls, { struct PayContext *pc = cls; - if ( (0 == memcmp (h_proposal_data, - &pc->h_proposal_data, + if ( (0 == memcmp (h_contract_terms, + &pc->h_contract_terms, sizeof (struct GNUNET_HashCode))) && (0 == memcmp (h_xwire, &pc->mi->h_wire, @@ -1046,8 +1046,8 @@ parse_pay (struct MHD_Connection *connection, GNUNET_break (0); return res; } - res = db->find_proposal_data (db->cls, - &pc->proposal_data, + res = db->find_contract_terms (db->cls, + &pc->contract_terms, order_id, &merchant_pub); if (GNUNET_OK != res) @@ -1065,8 +1065,8 @@ parse_pay (struct MHD_Connection *connection, } if (GNUNET_OK != - TALER_JSON_hash (pc->proposal_data, - &pc->h_proposal_data)) + TALER_JSON_hash (pc->contract_terms, + &pc->h_contract_terms)) { GNUNET_JSON_parse_free (spec); if (MHD_YES != @@ -1080,7 +1080,7 @@ parse_pay (struct MHD_Connection *connection, return GNUNET_NO; } - merchant = json_object_get (pc->proposal_data, + merchant = json_object_get (pc->contract_terms, "merchant"); if (NULL == merchant) { @@ -1138,7 +1138,7 @@ parse_pay (struct MHD_Connection *connection, }; res = TMH_PARSE_json_data (connection, - pc->proposal_data, + pc->contract_terms, espec); if (GNUNET_YES != res) { @@ -1175,7 +1175,7 @@ parse_pay (struct MHD_Connection *connection, } /* parse optional details */ - if (NULL != json_object_get (pc->proposal_data, + if (NULL != json_object_get (pc->contract_terms, "max_wire_fee")) { struct GNUNET_JSON_Specification espec[] = { @@ -1185,7 +1185,7 @@ parse_pay (struct MHD_Connection *connection, }; res = TMH_PARSE_json_data (connection, - pc->proposal_data, + pc->contract_terms, espec); if (GNUNET_YES != res) { @@ -1203,7 +1203,7 @@ parse_pay (struct MHD_Connection *connection, TALER_amount_get_zero (pc->max_fee.currency, &pc->max_wire_fee)); } - if (NULL != json_object_get (pc->proposal_data, + if (NULL != json_object_get (pc->contract_terms, "wire_fee_amortization")) { struct GNUNET_JSON_Specification espec[] = { @@ -1213,7 +1213,7 @@ parse_pay (struct MHD_Connection *connection, }; res = TMH_PARSE_json_data (connection, - pc->proposal_data, + pc->contract_terms, espec); if ( (GNUNET_YES != res) || (0 == pc->wire_fee_amortization) ) @@ -1297,7 +1297,7 @@ handler_pay_json (struct MHD_Connection *connection, /* Check if this payment attempt has already succeeded */ if (GNUNET_SYSERR == db->find_payments (db->cls, - &pc->h_proposal_data, + &pc->h_contract_terms, &pc->mi->pubkey, &check_coin_paid, pc)) @@ -1328,7 +1328,7 @@ handler_pay_json (struct MHD_Connection *connection, /* Check if transaction is already known, if not store it. */ if (GNUNET_SYSERR == db->find_transaction (db->cls, - &pc->h_proposal_data, + &pc->h_contract_terms, &pc->mi->pubkey, &check_transaction_exists, pc)) @@ -1351,7 +1351,7 @@ handler_pay_json (struct MHD_Connection *connection, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Dealing with new transaction '%s'\n", - GNUNET_h2s (&pc->h_proposal_data)); + GNUNET_h2s (&pc->h_contract_terms)); now = GNUNET_TIME_absolute_get (); if (now.abs_value_us > pc->pay_deadline.abs_value_us) @@ -1370,10 +1370,10 @@ handler_pay_json (struct MHD_Connection *connection, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing transaction '%s'\n", - GNUNET_h2s (&pc->h_proposal_data)); + GNUNET_h2s (&pc->h_contract_terms)); if (GNUNET_OK != db->store_transaction (db->cls, - &pc->h_proposal_data, + &pc->h_contract_terms, &pc->mi->pubkey, pc->chosen_exchange, &pc->mi->h_wire, diff --git a/src/backend/taler-merchant-httpd_proposal.c b/src/backend/taler-merchant-httpd_proposal.c index 36d174ac..fa8251c3 100644 --- a/src/backend/taler-merchant-httpd_proposal.c +++ b/src/backend/taler-merchant-httpd_proposal.c @@ -296,7 +296,7 @@ proposal_put (struct MHD_Connection *connection, /* fetch timestamp from order */ if (GNUNET_OK != - db->insert_proposal_data (db->cls, + db->insert_contract_terms (db->cls, order_id, &mi->pubkey, timestamp, @@ -405,7 +405,7 @@ MH_handler_proposal_lookup (struct TMH_RequestHandler *rh, const char *order_id; const char *instance; int res; - json_t *proposal_data; + json_t *contract_terms; struct MerchantInstance *mi; instance = MHD_lookup_connection_value (connection, @@ -427,8 +427,8 @@ MH_handler_proposal_lookup (struct TMH_RequestHandler *rh, TALER_EC_PARAMETER_MISSING, "order_id"); - res = db->find_proposal_data (db->cls, - &proposal_data, + res = db->find_contract_terms (db->cls, + &contract_terms, order_id, &mi->pubkey); if (GNUNET_NO == res) @@ -443,7 +443,7 @@ MH_handler_proposal_lookup (struct TMH_RequestHandler *rh, return TMH_RESPONSE_reply_json (connection, - proposal_data, + contract_terms, MHD_HTTP_OK); diff --git a/src/backend/taler-merchant-httpd_track-transaction.c b/src/backend/taler-merchant-httpd_track-transaction.c index 484f8b5f..eb1ee164 100644 --- a/src/backend/taler-merchant-httpd_track-transaction.c +++ b/src/backend/taler-merchant-httpd_track-transaction.c @@ -207,7 +207,7 @@ struct TrackTransactionContext /** * Proposal's hashcode. */ - struct GNUNET_HashCode h_proposal_data; + struct GNUNET_HashCode h_contract_terms; /** * Response code to return upon resume. @@ -405,7 +405,7 @@ wire_deposits_cb (void *cls, if (GNUNET_OK != db->store_coin_to_transfer (db->cls, - &details[i].h_proposal_data, + &details[i].h_contract_terms, &details[i].coin_pub, &tctx->current_wtid)) { @@ -561,7 +561,7 @@ trace_coins (struct TrackTransactionContext *tctx) tcc->dwh = TALER_EXCHANGE_track_transaction (tctx->eh, &tctx->mi->privkey, &tctx->h_wire, - &tctx->h_proposal_data, + &tctx->h_contract_terms, &tcc->coin_pub, &wtid_cb, tcc); @@ -731,7 +731,7 @@ static void transaction_cb (void *cls, const struct TALER_MerchantPublicKeyP *merchant_pub, const char *exchange_uri, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct GNUNET_HashCode *h_wire, struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute refund, @@ -739,7 +739,7 @@ transaction_cb (void *cls, { struct TrackTransactionContext *tctx = cls; - tctx->h_proposal_data = *h_proposal_data; + tctx->h_contract_terms = *h_contract_terms; tctx->exchange_uri = GNUNET_strdup (exchange_uri); tctx->h_wire = *h_wire; tctx->timestamp = timestamp; @@ -767,7 +767,7 @@ transaction_cb (void *cls, */ static void transfer_cb (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_WireTransferIdentifierRawP *wtid, struct GNUNET_TIME_Absolute execution_time, @@ -797,7 +797,7 @@ transfer_cb (void *cls, */ static void coin_cb (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *deposit_fee, @@ -816,7 +816,7 @@ coin_cb (void *cls, tcc); GNUNET_break (GNUNET_SYSERR != db->find_transfers_by_hash (db->cls, - h_proposal_data, + h_contract_terms, &transfer_cb, tcc)); } @@ -843,8 +843,8 @@ MH_handler_track_transaction (struct TMH_RequestHandler *rh, const char *instance; int ret; struct GNUNET_HashCode h_instance; - struct GNUNET_HashCode h_proposal_data; - struct json_t *proposal_data; + struct GNUNET_HashCode h_contract_terms; + struct json_t *contract_terms; if (NULL == *connection_cls) { @@ -917,37 +917,37 @@ MH_handler_track_transaction (struct TMH_RequestHandler *rh, TALER_EC_TRACK_TRANSACTION_INSTANCE_UNKNOWN, "unknown instance"); - if (GNUNET_YES != db->find_proposal_data (db->cls, - &proposal_data, + if (GNUNET_YES != db->find_contract_terms (db->cls, + &contract_terms, order_id, &tctx->mi->pubkey)) return TMH_RESPONSE_reply_not_found (connection, TALER_EC_PROPOSAL_LOOKUP_NOT_FOUND, "Given order_id doesn't map to any proposal"); - TALER_JSON_hash (proposal_data, - &h_proposal_data); + TALER_JSON_hash (contract_terms, + &h_contract_terms); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Trying to track h_proposal_data '%s'\n", - GNUNET_h2s (&h_proposal_data)); + "Trying to track h_contract_terms '%s'\n", + GNUNET_h2s (&h_contract_terms)); ret = db->find_transaction (db->cls, - &h_proposal_data, + &h_contract_terms, &tctx->mi->pubkey, &transaction_cb, tctx); if (GNUNET_NO == ret) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "h_proposal_data not found\n"); + "h_contract_terms not found\n"); return TMH_RESPONSE_reply_not_found (connection, TALER_EC_TRACK_TRANSACTION_TRANSACTION_UNKNOWN, - "h_proposal_data is unknown"); + "h_contract_terms is unknown"); } if ( (GNUNET_SYSERR == ret) || - (0 != memcmp (&tctx->h_proposal_data, - &h_proposal_data, + (0 != memcmp (&tctx->h_contract_terms, + &h_contract_terms, sizeof (struct GNUNET_HashCode))) || (NULL == tctx->exchange_uri) ) { @@ -957,7 +957,7 @@ MH_handler_track_transaction (struct TMH_RequestHandler *rh, "Database error"); } ret = db->find_payments (db->cls, - &h_proposal_data, + &h_contract_terms, &tctx->mi->pubkey, &coin_cb, tctx); diff --git a/src/backend/taler-merchant-httpd_track-transfer.c b/src/backend/taler-merchant-httpd_track-transfer.c index 63ea3dae..4ca22aff 100644 --- a/src/backend/taler-merchant-httpd_track-transfer.c +++ b/src/backend/taler-merchant-httpd_track-transfer.c @@ -127,7 +127,7 @@ struct TrackTransferContext /** * Represents an entry in the table used to sum up - * individual deposits for each h_proposal_data. + * individual deposits for each h_contract_terms. */ struct Entry { /** @@ -217,11 +217,11 @@ build_deposits_response (void *cls, struct TrackTransferContext *rctx = cls; json_t *element; struct Entry *entry = value; - json_t *proposal_data; + json_t *contract_terms; json_t *order_id; - if (GNUNET_OK != db->find_proposal_data_from_hash (db->cls, - &proposal_data, + if (GNUNET_OK != db->find_contract_terms_from_hash (db->cls, + &contract_terms, key, &rctx->mi->pubkey)) { @@ -229,7 +229,7 @@ build_deposits_response (void *cls, return GNUNET_NO; } - order_id = json_object_get (proposal_data, "order_id"); + order_id = json_object_get (contract_terms, "order_id"); element = json_pack ("{s:s, s:o, s:o}", "order_id", json_string_value (order_id), @@ -273,7 +273,7 @@ transform_response (const json_t *result, struct TrackTransferContext *rctx) struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_amount ("deposit_value", &iter_value), TALER_JSON_spec_amount ("deposit_fee", &iter_fee), - GNUNET_JSON_spec_string ("h_proposal_data", &key), + GNUNET_JSON_spec_string ("h_contract_terms", &key), GNUNET_JSON_spec_end () }; @@ -295,7 +295,7 @@ transform_response (const json_t *result, struct TrackTransferContext *rctx) if (NULL != (current_entry = GNUNET_CONTAINER_multihashmap_get (map, (const struct GNUNET_HashCode *) &h_key))) { - /*The map already knows this h_proposal_data*/ + /*The map already knows this h_contract_terms*/ if ((GNUNET_SYSERR == TALER_amount_add (¤t_entry->deposit_value, ¤t_entry->deposit_value, &iter_value)) || @@ -306,7 +306,7 @@ transform_response (const json_t *result, struct TrackTransferContext *rctx) } else { - /*First time in the map for this h_proposal_data*/ + /*First time in the map for this h_contract_terms*/ current_entry = GNUNET_malloc (sizeof (struct Entry)); memcpy (¤t_entry->deposit_value, &iter_value, sizeof (struct TALER_Amount)); memcpy (¤t_entry->deposit_fee, &iter_fee, sizeof (struct TALER_Amount)); @@ -398,7 +398,7 @@ track_transfer_cleanup (struct TM_HandlerContext *hc) */ static void check_transfer (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *deposit_fee, @@ -427,7 +427,7 @@ check_transfer (void *cls, "conflict_offset", (json_int_t) rctx->current_offset, "exchange_transfer_proof", rctx->original_response, "coin_pub", GNUNET_JSON_from_data_auto (coin_pub), - "h_proposal_data", GNUNET_JSON_from_data_auto (&ttd->h_proposal_data), + "h_contract_terms", GNUNET_JSON_from_data_auto (&ttd->h_contract_terms), "amount_with_fee", TALER_JSON_from_amount (amount_with_fee), "deposit_fee", TALER_JSON_from_amount (deposit_fee)); return; @@ -514,7 +514,7 @@ wire_transfer_cb (void *cls, rctx->current_detail = &details[i]; rctx->check_transfer_result = GNUNET_NO; ret = db->find_payments_by_hash_and_coin (db->cls, - &details[i].h_proposal_data, + &details[i].h_contract_terms, &rctx->mi->pubkey, &details[i].coin_pub, &check_transfer, @@ -570,7 +570,7 @@ wire_transfer_cb (void *cls, /* Response is consistent with the /deposit we made, remember it for future reference */ ret = db->store_coin_to_transfer (db->cls, - &details[i].h_proposal_data, + &details[i].h_contract_terms, &details[i].coin_pub, &rctx->wtid); if (GNUNET_OK != ret) diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index e5124bbc..52996904 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -147,7 +147,7 @@ postgres_drop_tables (void *cls) PG_EXEC_INDEX (pg, "DROP TABLE merchant_deposits;"); PG_EXEC_INDEX (pg, "DROP TABLE merchant_transactions;"); PG_EXEC_INDEX (pg, "DROP TABLE merchant_proofs;"); - PG_EXEC_INDEX (pg, "DROP TABLE merchant_proposal_data;"); + PG_EXEC_INDEX (pg, "DROP TABLE merchant_contract_terms;"); return GNUNET_OK; } @@ -165,11 +165,11 @@ postgres_initialize (void *cls) /* Setup tables */ PG_EXEC (pg, - "CREATE TABLE IF NOT EXISTS merchant_proposal_data (" + "CREATE TABLE IF NOT EXISTS merchant_contract_terms (" "order_id VARCHAR NOT NULL" ",merchant_pub BYTEA NOT NULL" - ",proposal_data BYTEA NOT NULL" - ",h_proposal_data BYTEA NOT NULL" + ",contract_terms BYTEA NOT NULL" + ",h_contract_terms BYTEA NOT NULL" ",timestamp INT8 NOT NULL" ",row_id BIGSERIAL" ",PRIMARY KEY (order_id, merchant_pub)" @@ -177,7 +177,7 @@ postgres_initialize (void *cls) PG_EXEC (pg, "CREATE TABLE IF NOT EXISTS merchant_transactions (" - " h_proposal_data BYTEA NOT NULL" + " h_contract_terms BYTEA NOT NULL" ",exchange_uri VARCHAR NOT NULL" ",merchant_pub BYTEA NOT NULL CHECK (LENGTH(merchant_pub)=32)" ",h_wire BYTEA NOT NULL CHECK (LENGTH(h_wire)=64)" @@ -186,13 +186,13 @@ postgres_initialize (void *cls) ",total_amount_val INT8 NOT NULL" ",total_amount_frac INT4 NOT NULL" ",total_amount_curr VARCHAR(" TALER_CURRENCY_LEN_STR ") NOT NULL" - ",PRIMARY KEY (h_proposal_data, merchant_pub)" + ",PRIMARY KEY (h_contract_terms, merchant_pub)" ");"); PG_EXEC (pg, "CREATE TABLE IF NOT EXISTS merchant_deposits (" - " h_proposal_data BYTEA NOT NULL" + " h_contract_terms BYTEA NOT NULL" ",merchant_pub BYTEA NOT NULL CHECK (LENGTH(merchant_pub)=32)" - ",FOREIGN KEY (h_proposal_data, merchant_pub) REFERENCES merchant_transactions (h_proposal_data, merchant_pub)" + ",FOREIGN KEY (h_contract_terms, merchant_pub) REFERENCES merchant_transactions (h_contract_terms, merchant_pub)" ",coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)" ",amount_with_fee_val INT8 NOT NULL" ",amount_with_fee_frac INT4 NOT NULL" @@ -202,7 +202,7 @@ postgres_initialize (void *cls) ",deposit_fee_curr VARCHAR(" TALER_CURRENCY_LEN_STR ") NOT NULL" ",signkey_pub BYTEA NOT NULL CHECK (LENGTH(signkey_pub)=32)" ",exchange_proof BYTEA NOT NULL" - ",PRIMARY KEY (h_proposal_data, coin_pub)" + ",PRIMARY KEY (h_contract_terms, coin_pub)" ");"); PG_EXEC (pg, "CREATE TABLE IF NOT EXISTS merchant_proofs (" @@ -213,19 +213,19 @@ postgres_initialize (void *cls) ",proof BYTEA NOT NULL" ",PRIMARY KEY (wtid, exchange_uri)" ");"); - /* Note that h_proposal_data + coin_pub may actually be unknown to + /* Note that h_contract_terms + coin_pub may actually be unknown to us, e.g. someone else deposits something for us at the exchange. Hence those cannot be foreign keys into deposits/transactions! */ PG_EXEC (pg, "CREATE TABLE IF NOT EXISTS merchant_transfers (" - " h_proposal_data BYTEA NOT NULL" + " h_contract_terms BYTEA NOT NULL" ",coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)" ",wtid BYTEA NOT NULL CHECK (LENGTH(wtid)=32)" - ",PRIMARY KEY (h_proposal_data, coin_pub)" + ",PRIMARY KEY (h_contract_terms, coin_pub)" ");"); PG_EXEC_INDEX (pg, "CREATE INDEX IF NOT EXISTS merchant_transfers_by_coin" - " ON merchant_transfers (h_proposal_data, coin_pub)"); + " ON merchant_transfers (h_contract_terms, coin_pub)"); PG_EXEC_INDEX (pg, "CREATE INDEX IF NOT EXISTS merchant_transfers_by_wtid" " ON merchant_transfers (wtid)"); @@ -234,7 +234,7 @@ postgres_initialize (void *cls) PG_PREPARE (pg, "insert_transaction", "INSERT INTO merchant_transactions" - "(h_proposal_data" + "(h_contract_terms" ",exchange_uri" ",merchant_pub" ",h_wire" @@ -249,7 +249,7 @@ postgres_initialize (void *cls) PG_PREPARE (pg, "insert_deposit", "INSERT INTO merchant_deposits" - "(h_proposal_data" + "(h_contract_terms" ",merchant_pub" ",coin_pub" ",amount_with_fee_val" @@ -265,7 +265,7 @@ postgres_initialize (void *cls) PG_PREPARE (pg, "insert_transfer", "INSERT INTO merchant_transfers" - "(h_proposal_data" + "(h_contract_terms" ",coin_pub" ",wtid) VALUES " "($1, $2, $3)", @@ -282,44 +282,44 @@ postgres_initialize (void *cls) 5); PG_PREPARE (pg, - "insert_proposal_data", - "INSERT INTO merchant_proposal_data" + "insert_contract_terms", + "INSERT INTO merchant_contract_terms" "(order_id" ",merchant_pub" ",timestamp" - ",proposal_data" - ",h_proposal_data)" + ",contract_terms" + ",h_contract_terms)" " VALUES " "($1, $2, $3, $4, $5)", 4); PG_PREPARE (pg, - "find_proposal_data_from_hash", + "find_contract_terms_from_hash", "SELECT" - " proposal_data" - " FROM merchant_proposal_data" + " contract_terms" + " FROM merchant_contract_terms" " WHERE" - " h_proposal_data=$1" + " h_contract_terms=$1" " AND merchant_pub=$2", 2); PG_PREPARE (pg, - "find_proposal_data", + "find_contract_terms", "SELECT" - " proposal_data" - " FROM merchant_proposal_data" + " contract_terms" + " FROM merchant_contract_terms" " WHERE" " order_id=$1" " AND merchant_pub=$2", 2); PG_PREPARE (pg, - "find_proposal_data_by_date", + "find_contract_terms_by_date", "SELECT" - " proposal_data" + " contract_terms" ",order_id" ",row_id" - " FROM merchant_proposal_data" + " FROM merchant_contract_terms" " WHERE" " timestamp<$1" " AND merchant_pub=$2" @@ -328,12 +328,12 @@ postgres_initialize (void *cls) 3); PG_PREPARE (pg, - "find_proposal_data_by_date_and_range", + "find_contract_terms_by_date_and_range", "SELECT" - " proposal_data" + " contract_terms" ",order_id" ",row_id" - " FROM merchant_proposal_data" + " FROM merchant_contract_terms" " WHERE" " timestamp<$1" " AND merchant_pub=$2" @@ -343,12 +343,12 @@ postgres_initialize (void *cls) 4); PG_PREPARE (pg, - "find_proposal_data_by_date_and_range_future", + "find_contract_terms_by_date_and_range_future", "SELECT" - " proposal_data" + " contract_terms" ",order_id" ",row_id" - " FROM merchant_proposal_data" + " FROM merchant_contract_terms" " WHERE" " timestamp>$1" " AND merchant_pub=$2" @@ -369,7 +369,7 @@ postgres_initialize (void *cls) ",total_amount_frac" ",total_amount_curr" " FROM merchant_transactions" - " WHERE h_proposal_data=$1" + " WHERE h_contract_terms=$1" " AND merchant_pub=$2", 2); PG_PREPARE (pg, @@ -384,7 +384,7 @@ postgres_initialize (void *cls) ",deposit_fee_curr" ",exchange_proof" " FROM merchant_deposits" - " WHERE h_proposal_data=$1" + " WHERE h_contract_terms=$1" " AND merchant_pub=$2", 2); PG_PREPARE (pg, @@ -398,7 +398,7 @@ postgres_initialize (void *cls) ",deposit_fee_curr" ",exchange_proof" " FROM merchant_deposits" - " WHERE h_proposal_data=$1" + " WHERE h_contract_terms=$1" " AND merchant_pub=$2" " AND coin_pub=$3", 3); @@ -411,12 +411,12 @@ postgres_initialize (void *cls) ",merchant_proofs.proof" " FROM merchant_transfers" " JOIN merchant_proofs USING (wtid)" - " WHERE h_proposal_data=$1", + " WHERE h_contract_terms=$1", 1); PG_PREPARE (pg, "find_deposits_by_wtid", "SELECT" - " merchant_transfers.h_proposal_data" + " merchant_transfers.h_contract_terms" ",merchant_transfers.coin_pub" ",merchant_deposits.amount_with_fee_val" ",merchant_deposits.amount_with_fee_frac" @@ -427,7 +427,7 @@ postgres_initialize (void *cls) ",merchant_deposits.exchange_proof" " FROM merchant_transfers" " JOIN merchant_deposits" - " ON (merchant_deposits.h_proposal_data = merchant_transfers.h_proposal_data" + " ON (merchant_deposits.h_contract_terms = merchant_transfers.h_contract_terms" " AND" " merchant_deposits.coin_pub = merchant_transfers.coin_pub)" " WHERE wtid=$1", @@ -447,16 +447,16 @@ postgres_initialize (void *cls) * Retrieve proposal data given its proposal data's hashcode * * @param cls closure - * @param proposal_data where to store the retrieved proposal data - * @param h_proposal_data proposal data's hashcode that will be used to + * @param contract_terms where to store the retrieved proposal data + * @param h_contract_terms proposal data's hashcode that will be used to * perform the lookup * @return #GNUNET_OK on success, #GNUNET_NO if no proposal is * found, #GNUNET_SYSERR upon error */ static int -postgres_find_proposal_data_from_hash (void *cls, - json_t **proposal_data, - const struct GNUNET_HashCode *h_proposal_data, +postgres_find_contract_terms_from_hash (void *cls, + json_t **contract_terms, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub) { struct PostgresClosure *pg = cls; @@ -464,13 +464,13 @@ postgres_find_proposal_data_from_hash (void *cls, unsigned int i; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (h_contract_terms), GNUNET_PQ_query_param_auto_from_type (merchant_pub), GNUNET_PQ_query_param_end }; result = GNUNET_PQ_exec_prepared (pg->conn, - "find_proposal_data_from_hash", + "find_contract_terms_from_hash", params); i = PQntuples (result); if (1 < i) @@ -484,8 +484,8 @@ postgres_find_proposal_data_from_hash (void *cls, return GNUNET_NO; struct GNUNET_PQ_ResultSpec rs[] = { - TALER_PQ_result_spec_json ("proposal_data", - proposal_data), + TALER_PQ_result_spec_json ("contract_terms", + contract_terms), GNUNET_PQ_result_spec_end }; if (GNUNET_OK != @@ -506,14 +506,14 @@ postgres_find_proposal_data_from_hash (void *cls, * Retrieve proposal data given its order id. * * @param cls closure - * @param proposal_data where to store the retrieved proposal data + * @param contract_terms where to store the retrieved proposal data * @param order id order id used to perform the lookup * @return #GNUNET_OK on success, #GNUNET_NO if no proposal is * found, #GNUNET_SYSERR upon error */ static int -postgres_find_proposal_data (void *cls, - json_t **proposal_data, +postgres_find_contract_terms (void *cls, + json_t **contract_terms, const char *order_id, const struct TALER_MerchantPublicKeyP *merchant_pub) { @@ -528,7 +528,7 @@ postgres_find_proposal_data (void *cls, }; result = GNUNET_PQ_exec_prepared (pg->conn, - "find_proposal_data", + "find_contract_terms", params); i = PQntuples (result); if (1 < i) @@ -542,8 +542,8 @@ postgres_find_proposal_data (void *cls, return GNUNET_NO; struct GNUNET_PQ_ResultSpec rs[] = { - TALER_PQ_result_spec_json ("proposal_data", - proposal_data), + TALER_PQ_result_spec_json ("contract_terms", + contract_terms), GNUNET_PQ_result_spec_end }; if (GNUNET_OK != @@ -565,36 +565,36 @@ postgres_find_proposal_data (void *cls, * * @param cls closure * @param order_id identificator of the proposal being stored - * @param proposal_data proposal data to store + * @param contract_terms proposal data to store * @return #GNUNET_OK on success, #GNUNET_SYSERR upon error */ static int -postgres_insert_proposal_data (void *cls, +postgres_insert_contract_terms (void *cls, const char *order_id, const struct TALER_MerchantPublicKeyP *merchant_pub, struct GNUNET_TIME_Absolute timestamp, - const json_t *proposal_data) + const json_t *contract_terms) { struct PostgresClosure *pg = cls; PGresult *result; int ret; - struct GNUNET_HashCode h_proposal_data; + struct GNUNET_HashCode h_contract_terms; - if (GNUNET_OK != TALER_JSON_hash (proposal_data, - &h_proposal_data)) + if (GNUNET_OK != TALER_JSON_hash (contract_terms, + &h_contract_terms)) return GNUNET_SYSERR; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (order_id), GNUNET_PQ_query_param_auto_from_type (merchant_pub), GNUNET_PQ_query_param_absolute_time (×tamp), - TALER_PQ_query_param_json (proposal_data), - GNUNET_PQ_query_param_auto_from_type (&h_proposal_data), + TALER_PQ_query_param_json (contract_terms), + GNUNET_PQ_query_param_auto_from_type (&h_contract_terms), GNUNET_PQ_query_param_end }; result = GNUNET_PQ_exec_prepared (pg->conn, - "insert_proposal_data", + "insert_contract_terms", params); /** @@ -623,7 +623,7 @@ postgres_insert_proposal_data (void *cls, * Insert transaction data into the database. * * @param cls closure - * @param h_proposal_data hashcode of the proposal data associated with the + * @param h_contract_terms hashcode of the proposal data associated with the * transaction being stored * @param merchant_pub merchant's public key * @param exchange_uri URI of the exchange @@ -635,7 +635,7 @@ postgres_insert_proposal_data (void *cls, */ static int postgres_store_transaction (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub, const char *exchange_uri, const struct GNUNET_HashCode *h_wire, @@ -648,7 +648,7 @@ postgres_store_transaction (void *cls, int ret; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (h_contract_terms), GNUNET_PQ_query_param_string (exchange_uri), GNUNET_PQ_query_param_auto_from_type (merchant_pub), GNUNET_PQ_query_param_auto_from_type (h_wire), @@ -659,8 +659,8 @@ postgres_store_transaction (void *cls, }; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Storing transaction with h_proposal_data '%s'\n", - GNUNET_h2s (h_proposal_data)); + "Storing transaction with h_contract_terms '%s'\n", + GNUNET_h2s (h_contract_terms)); result = GNUNET_PQ_exec_prepared (pg->conn, "insert_transaction", @@ -694,7 +694,7 @@ postgres_store_transaction (void *cls, */ static int postgres_store_deposit (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_Amount *amount_with_fee, @@ -707,7 +707,7 @@ postgres_store_deposit (void *cls, int ret; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (h_contract_terms), GNUNET_PQ_query_param_auto_from_type (merchant_pub), GNUNET_PQ_query_param_auto_from_type (coin_pub), TALER_PQ_query_param_amount (amount_with_fee), @@ -718,8 +718,8 @@ postgres_store_deposit (void *cls, }; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "storing payment for h_proposal_data '%s'\n", - GNUNET_h2s (h_proposal_data)); + "storing payment for h_contract_terms '%s'\n", + GNUNET_h2s (h_contract_terms)); result = GNUNET_PQ_exec_prepared (pg->conn, "insert_deposit", params); @@ -738,11 +738,11 @@ postgres_store_deposit (void *cls, /** - * Insert mapping of @a coin_pub and @a h_proposal_data to + * Insert mapping of @a coin_pub and @a h_contract_terms to * corresponding @a wtid. * * @param cls closure - * @param h_proposal_data hashcode of the proposal data paid by @a coin_pub + * @param h_contract_terms hashcode of the proposal data paid by @a coin_pub * @param coin_pub public key of the coin * @param wtid identifier of the wire transfer in which the exchange * send us the money for the coin deposit @@ -750,7 +750,7 @@ postgres_store_deposit (void *cls, */ static int postgres_store_coin_to_transfer (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_WireTransferIdentifierRawP *wtid) { @@ -759,7 +759,7 @@ postgres_store_coin_to_transfer (void *cls, int ret; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (h_contract_terms), GNUNET_PQ_query_param_auto_from_type (coin_pub), GNUNET_PQ_query_param_auto_from_type (wtid), GNUNET_PQ_query_param_end @@ -843,7 +843,7 @@ postgres_store_transfer_to_proof (void *cls, * query being successful, unsuccessful, or generated errors. */ static int -postgres_find_proposal_data_history (void *cls, +postgres_find_contract_terms_history (void *cls, const char *order_id, const struct TALER_MerchantPublicKeyP *merchant_pub, TALER_MERCHANTDB_ProposalDataCallback cb, @@ -852,7 +852,7 @@ postgres_find_proposal_data_history (void *cls, struct PostgresClosure *pg = cls; PGresult *result; unsigned int i; - json_t *proposal_data; + json_t *contract_terms; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (order_id), @@ -861,7 +861,7 @@ postgres_find_proposal_data_history (void *cls, }; result = GNUNET_PQ_exec_prepared (pg->conn, - "find_proposal_data", + "find_contract_terms", params); i = PQntuples (result); if (1 < i) @@ -875,8 +875,8 @@ postgres_find_proposal_data_history (void *cls, return GNUNET_NO; struct GNUNET_PQ_ResultSpec rs[] = { - TALER_PQ_result_spec_json ("proposal_data", - &proposal_data), + TALER_PQ_result_spec_json ("contract_terms", + &contract_terms), GNUNET_PQ_result_spec_end }; if (GNUNET_OK != @@ -892,7 +892,7 @@ postgres_find_proposal_data_history (void *cls, cb (cb_cls, order_id, 0, - proposal_data); + contract_terms); PQclear (result); return GNUNET_OK; @@ -912,7 +912,7 @@ postgres_find_proposal_data_history (void *cls, * instance are returned. * @param start only rows with serial id less than start are returned. * In other words, you lower `start` to get older records. The tipical - * usage is to firstly call `find_proposal_data_by_date`, so that you get + * usage is to firstly call `find_contract_terms_by_date`, so that you get * the `nrows` youngest records. The oldest of those records will tell you * from which timestamp and `start` you can query the DB in order to get * furtherly older records, and so on. Alternatively, you can use always @@ -926,7 +926,7 @@ postgres_find_proposal_data_history (void *cls, * @return numer of found tuples, #GNUNET_SYSERR upon error */ static int -postgres_find_proposal_data_by_date_and_range (void *cls, +postgres_find_contract_terms_by_date_and_range (void *cls, struct GNUNET_TIME_Absolute date, const struct TALER_MerchantPublicKeyP *merchant_pub, unsigned int start, @@ -950,11 +950,11 @@ postgres_find_proposal_data_by_date_and_range (void *cls, if (GNUNET_YES == future) result = GNUNET_PQ_exec_prepared (pg->conn, - "find_proposal_data_by_date_and_range_future", + "find_contract_terms_by_date_and_range_future", params); else result = GNUNET_PQ_exec_prepared (pg->conn, - "find_proposal_data_by_date_and_range", + "find_contract_terms_by_date_and_range", params); if (PGRES_TUPLES_OK != PQresultStatus (result)) { @@ -973,14 +973,14 @@ postgres_find_proposal_data_by_date_and_range (void *cls, for (unsigned int i = 0; i < n; i++) { char *order_id; - json_t *proposal_data; + json_t *contract_terms; uint64_t row_id; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_string ("order_id", &order_id), - TALER_PQ_result_spec_json ("proposal_data", - &proposal_data), + TALER_PQ_result_spec_json ("contract_terms", + &contract_terms), GNUNET_PQ_result_spec_uint64 ("row_id", &row_id), GNUNET_PQ_result_spec_end @@ -998,7 +998,7 @@ postgres_find_proposal_data_by_date_and_range (void *cls, cb (cb_cls, order_id, row_id, - proposal_data); + contract_terms); GNUNET_PQ_cleanup_result (rs); } @@ -1021,7 +1021,7 @@ postgres_find_proposal_data_by_date_and_range (void *cls, * @return numer of found tuples, #GNUNET_SYSERR upon error */ static int -postgres_find_proposal_data_by_date (void *cls, +postgres_find_contract_terms_by_date (void *cls, struct GNUNET_TIME_Absolute date, const struct TALER_MerchantPublicKeyP *merchant_pub, unsigned int nrows, @@ -1042,7 +1042,7 @@ postgres_find_proposal_data_by_date (void *cls, GNUNET_PQ_query_param_end }; result = GNUNET_PQ_exec_prepared (pg->conn, - "find_proposal_data_by_date", + "find_contract_terms_by_date", params); if (PGRES_TUPLES_OK != PQresultStatus (result)) { @@ -1058,14 +1058,14 @@ postgres_find_proposal_data_by_date (void *cls, for (i = 0; i < n; i++) { char *order_id; - json_t *proposal_data; + json_t *contract_terms; uint64_t row_id; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_string ("order_id", &order_id), - TALER_PQ_result_spec_json ("proposal_data", - &proposal_data), + TALER_PQ_result_spec_json ("contract_terms", + &contract_terms), GNUNET_PQ_result_spec_uint64 ("row_id", &row_id), GNUNET_PQ_result_spec_end @@ -1083,7 +1083,7 @@ postgres_find_proposal_data_by_date (void *cls, cb (cb_cls, order_id, row_id, - proposal_data); + contract_terms); GNUNET_PQ_cleanup_result (rs); } @@ -1095,7 +1095,7 @@ postgres_find_proposal_data_by_date (void *cls, * Find information about a transaction. * * @param cls our plugin handle - * @param h_proposal_data value used to perform the lookup + * @param h_contract_terms value used to perform the lookup * @param merchant_pub merchant's public key * @param cb function to call with transaction data * @param cb_cls closure for @a cb @@ -1104,7 +1104,7 @@ postgres_find_proposal_data_by_date (void *cls, */ static int postgres_find_transaction (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub, TALER_MERCHANTDB_TransactionCallback cb, void *cb_cls) @@ -1112,14 +1112,14 @@ postgres_find_transaction (void *cls, struct PostgresClosure *pg = cls; PGresult *result; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (h_contract_terms), GNUNET_PQ_query_param_auto_from_type (merchant_pub), GNUNET_PQ_query_param_end }; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Finding transaction for h_proposal_data '%s'\n", - GNUNET_h2s (h_proposal_data)); + "Finding transaction for h_contract_terms '%s'\n", + GNUNET_h2s (h_contract_terms)); result = GNUNET_PQ_exec_prepared (pg->conn, "find_transaction", @@ -1133,8 +1133,8 @@ postgres_find_transaction (void *cls, if (0 == PQntuples (result)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Could NOT find transaction for h_proposal_data '%s'\n", - GNUNET_h2s (h_proposal_data)); + "Could NOT find transaction for h_contract_terms '%s'\n", + GNUNET_h2s (h_contract_terms)); PQclear (result); return GNUNET_NO; @@ -1178,7 +1178,7 @@ postgres_find_transaction (void *cls, cb (cb_cls, merchant_pub, exchange_uri, - h_proposal_data, + h_contract_terms, &h_wire, timestamp, refund_deadline, @@ -1195,7 +1195,7 @@ postgres_find_transaction (void *cls, * (and @a merchant_pub) * * @param cls closure - * @param h_proposal_data key for the search + * @param h_contract_terms key for the search * @param merchant_pub merchant's public key * @param cb function to call with payment data * @param cb_cls closure for @a cb @@ -1204,7 +1204,7 @@ postgres_find_transaction (void *cls, */ static int postgres_find_payments (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub, TALER_MERCHANTDB_CoinDepositCallback cb, void *cb_cls) @@ -1214,13 +1214,13 @@ postgres_find_payments (void *cls, unsigned int i; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (h_contract_terms), GNUNET_PQ_query_param_auto_from_type (merchant_pub), GNUNET_PQ_query_param_end }; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "finding payment for h_proposal_data '%s'\n", - GNUNET_h2s (h_proposal_data)); + "finding payment for h_contract_terms '%s'\n", + GNUNET_h2s (h_contract_terms)); result = GNUNET_PQ_exec_prepared (pg->conn, "find_deposits", params); @@ -1265,7 +1265,7 @@ postgres_find_payments (void *cls, return GNUNET_SYSERR; } cb (cb_cls, - h_proposal_data, + h_contract_terms, &coin_pub, &amount_with_fee, &deposit_fee, @@ -1284,7 +1284,7 @@ postgres_find_payments (void *cls, * Retrieve information about a deposited coin. * * @param cls closure - * @param h_proposal_data hashcode of the proposal data paid by @a coin_pub + * @param h_contract_terms hashcode of the proposal data paid by @a coin_pub * @param merchant_pub merchant's public key. * @param coin_pub coin's public key used for the search * @param cb function to call with payment data @@ -1294,7 +1294,7 @@ postgres_find_payments (void *cls, */ static int postgres_find_payments_by_hash_and_coin (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, TALER_MERCHANTDB_CoinDepositCallback cb, @@ -1305,7 +1305,7 @@ postgres_find_payments_by_hash_and_coin (void *cls, unsigned int i; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (h_contract_terms), GNUNET_PQ_query_param_auto_from_type (merchant_pub), GNUNET_PQ_query_param_auto_from_type (coin_pub), GNUNET_PQ_query_param_end @@ -1352,7 +1352,7 @@ postgres_find_payments_by_hash_and_coin (void *cls, return GNUNET_SYSERR; } cb (cb_cls, - h_proposal_data, + h_contract_terms, coin_pub, &amount_with_fee, &deposit_fee, @@ -1368,14 +1368,14 @@ postgres_find_payments_by_hash_and_coin (void *cls, /** - * Lookup information about a transfer by @a h_proposal_data. Note + * Lookup information about a transfer by @a h_contract_terms. Note * that in theory there could be multiple wire transfers for a - * single @a h_proposal_data, as the transaction may have involved + * single @a h_contract_terms, as the transaction may have involved * multiple coins and the coins may be spread over different wire * transfers. * * @param cls closure - * @param h_proposal_data key for the search + * @param h_contract_terms key for the search * @param cb function to call with transfer data * @param cb_cls closure for @a cb * @return #GNUNET_OK on success, #GNUNET_NO if transaction Id is unknown, @@ -1383,7 +1383,7 @@ postgres_find_payments_by_hash_and_coin (void *cls, */ static int postgres_find_transfers_by_hash (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, TALER_MERCHANTDB_TransferCallback cb, void *cb_cls) { @@ -1392,7 +1392,7 @@ postgres_find_transfers_by_hash (void *cls, unsigned int i; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (h_contract_terms), GNUNET_PQ_query_param_end }; result = GNUNET_PQ_exec_prepared (pg->conn, @@ -1439,7 +1439,7 @@ postgres_find_transfers_by_hash (void *cls, return GNUNET_SYSERR; } cb (cb_cls, - h_proposal_data, + h_contract_terms, &coin_pub, &wtid, execution_time, @@ -1492,15 +1492,15 @@ postgres_find_deposits_by_wtid (void *cls, for (i=0;ifind_transfers_by_hash = &postgres_find_transfers_by_hash; plugin->find_deposits_by_wtid = &postgres_find_deposits_by_wtid; plugin->find_proof_by_wtid = &postgres_find_proof_by_wtid; - plugin->insert_proposal_data = &postgres_insert_proposal_data; - plugin->find_proposal_data = &postgres_find_proposal_data; - plugin->find_proposal_data_history = &postgres_find_proposal_data_history; - plugin->find_proposal_data_by_date = &postgres_find_proposal_data_by_date; - plugin->find_proposal_data_by_date_and_range = &postgres_find_proposal_data_by_date_and_range; - plugin->find_proposal_data_from_hash = &postgres_find_proposal_data_from_hash; + plugin->insert_contract_terms = &postgres_insert_contract_terms; + plugin->find_contract_terms = &postgres_find_contract_terms; + plugin->find_contract_terms_history = &postgres_find_contract_terms_history; + plugin->find_contract_terms_by_date = &postgres_find_contract_terms_by_date; + plugin->find_contract_terms_by_date_and_range = &postgres_find_contract_terms_by_date_and_range; + plugin->find_contract_terms_from_hash = &postgres_find_contract_terms_from_hash; return plugin; } diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c index 011ec9ea..c5126518 100644 --- a/src/backenddb/test_merchantdb.c +++ b/src/backenddb/test_merchantdb.c @@ -72,19 +72,19 @@ const char *order_id; /** * Transaction ID used to test the db query - * `find_proposal_data_by_date_and_range_future` + * `find_contract_terms_by_date_and_range_future` */ const char *order_id_future; /** * Proposal's hash */ -struct GNUNET_HashCode h_proposal_data; +struct GNUNET_HashCode h_contract_terms; /** * Proposal's hash. */ -struct GNUNET_HashCode h_proposal_data2; +struct GNUNET_HashCode h_contract_terms2; /** * Time of the transaction. @@ -150,7 +150,7 @@ static json_t *contract; /** * Mock proposal data, not need to be well-formed */ -static json_t *proposal_data; +static json_t *contract_terms; @@ -170,7 +170,7 @@ static void transaction_cb (void *cls, const struct TALER_MerchantPublicKeyP *amerchant_pub, const char *aexchange_uri, - const struct GNUNET_HashCode *ah_proposal_data, + const struct GNUNET_HashCode *ah_contract_terms, const struct GNUNET_HashCode *ah_wire, struct GNUNET_TIME_Absolute atimestamp, struct GNUNET_TIME_Absolute arefund_deadline, @@ -180,8 +180,8 @@ transaction_cb (void *cls, CHECK (0 == memcmp (amerchant_pub, &merchant_pub, sizeof (struct TALER_MerchantPublicKeyP))); - CHECK (0 == memcmp (ah_proposal_data, - &h_proposal_data, + CHECK (0 == memcmp (ah_contract_terms, + &h_contract_terms, sizeof (struct GNUNET_HashCode))); CHECK (0 == strcmp (aexchange_uri, EXCHANGE_URI)); @@ -195,18 +195,18 @@ transaction_cb (void *cls, } /** - * Callback for `find_proposal_data_by_date`. + * Callback for `find_contract_terms_by_date`. * * @param cls closure * @param order_id order id * @param row_id row id in db - * @param proposal_data proposal data + * @param contract_terms proposal data */ static void pd_cb (void *cls, const char *order_id, uint64_t row_id, - const json_t *proposal_data) + const json_t *contract_terms) { return; } @@ -223,14 +223,14 @@ pd_cb (void *cls, */ static void deposit_cb (void *cls, - const struct GNUNET_HashCode *ah_proposal_data, + const struct GNUNET_HashCode *ah_contract_terms, const struct TALER_CoinSpendPublicKeyP *acoin_pub, const struct TALER_Amount *aamount_with_fee, const struct TALER_Amount *adeposit_fee, const json_t *aexchange_proof) { - CHECK ((0 == memcmp (ah_proposal_data, - &h_proposal_data, + CHECK ((0 == memcmp (ah_contract_terms, + &h_contract_terms, sizeof (struct GNUNET_HashCode)))); CHECK (0 == memcmp (acoin_pub, &coin_pub, @@ -263,14 +263,14 @@ deposit_cb (void *cls, */ static void transfer_cb (void *cls, - const struct GNUNET_HashCode *ah_proposal_data, + const struct GNUNET_HashCode *ah_contract_terms, const struct TALER_CoinSpendPublicKeyP *acoin_pub, const struct TALER_WireTransferIdentifierRawP *awtid, struct GNUNET_TIME_Absolute execution_time, const json_t *exchange_proof) { - CHECK (0 == memcmp (ah_proposal_data, - &h_proposal_data, + CHECK (0 == memcmp (ah_contract_terms, + &h_contract_terms, sizeof (struct GNUNET_HashCode))); CHECK (0 == memcmp (acoin_pub, @@ -330,7 +330,7 @@ run (void *cls) /* Prepare data for 'store_payment()' */ RND_BLK (&h_wire); - RND_BLK (&h_proposal_data); + RND_BLK (&h_contract_terms); order_id = "test_ID"; order_id_future = "test_ID_future"; RND_BLK (&signkey_pub); @@ -360,40 +360,40 @@ run (void *cls) "test", json_string ("backenddb test B"))); contract = json_object (); - proposal_data = json_object (); + contract_terms = json_object (); - TALER_JSON_hash (proposal_data, - &h_proposal_data2); + TALER_JSON_hash (contract_terms, + &h_contract_terms2); FAILIF (GNUNET_OK != - plugin->insert_proposal_data (plugin->cls, + plugin->insert_contract_terms (plugin->cls, order_id, &merchant_pub, timestamp, - proposal_data)); + contract_terms)); json_t *out; FAILIF (GNUNET_OK != - plugin->find_proposal_data (plugin->cls, + plugin->find_contract_terms (plugin->cls, &out, order_id, &merchant_pub)); FAILIF (GNUNET_OK != - plugin->find_proposal_data_history (plugin->cls, + plugin->find_contract_terms_history (plugin->cls, order_id, &merchant_pub, pd_cb, NULL)); FAILIF (GNUNET_OK != - plugin->find_proposal_data_from_hash (plugin->cls, + plugin->find_contract_terms_from_hash (plugin->cls, &out, - &h_proposal_data2, + &h_contract_terms2, &merchant_pub)); FAILIF (1 != - plugin->find_proposal_data_by_date_and_range (plugin->cls, + plugin->find_contract_terms_by_date_and_range (plugin->cls, fake_now, &merchant_pub, 2, @@ -405,16 +405,16 @@ run (void *cls) GNUNET_TIME_round_abs (×tamp); FAILIF (GNUNET_OK != - plugin->insert_proposal_data (plugin->cls, + plugin->insert_contract_terms (plugin->cls, order_id_future, &merchant_pub, timestamp, - proposal_data)); + contract_terms)); fake_now = GNUNET_TIME_absolute_subtract (timestamp, delta); FAILIF (2 != - plugin->find_proposal_data_by_date_and_range (plugin->cls, + plugin->find_contract_terms_by_date_and_range (plugin->cls, fake_now, &merchant_pub, 0, @@ -424,7 +424,7 @@ run (void *cls) NULL)); FAILIF (0 != - plugin->find_proposal_data_by_date (plugin->cls, + plugin->find_contract_terms_by_date (plugin->cls, fake_now, &merchant_pub, 1, @@ -433,7 +433,7 @@ run (void *cls) FAILIF (GNUNET_OK != plugin->store_transaction (plugin->cls, - &h_proposal_data, + &h_contract_terms, &merchant_pub, EXCHANGE_URI, &h_wire, @@ -442,7 +442,7 @@ run (void *cls) &amount_with_fee)); FAILIF (GNUNET_OK != plugin->store_deposit (plugin->cls, - &h_proposal_data, + &h_contract_terms, &merchant_pub, &coin_pub, &amount_with_fee, @@ -451,7 +451,7 @@ run (void *cls) deposit_proof)); FAILIF (GNUNET_OK != plugin->store_coin_to_transfer (plugin->cls, - &h_proposal_data, + &h_contract_terms, &coin_pub, &wtid)); FAILIF (GNUNET_OK != @@ -463,20 +463,20 @@ run (void *cls) transfer_proof)); FAILIF (GNUNET_OK != plugin->find_transaction (plugin->cls, - &h_proposal_data, + &h_contract_terms, &merchant_pub, &transaction_cb, NULL)); FAILIF (GNUNET_OK != plugin->find_payments (plugin->cls, - &h_proposal_data, + &h_contract_terms, &merchant_pub, &deposit_cb, NULL)); FAILIF (GNUNET_OK != plugin->find_transfers_by_hash (plugin->cls, - &h_proposal_data, + &h_contract_terms, &transfer_cb, NULL)); FAILIF (GNUNET_OK != diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 132a4c95..aee46af5 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -52,7 +52,7 @@ struct TALER_MERCHANT_ProposalLookupOperation; * 0 if the backend's reply is bogus (fails to follow the protocol) * @param ec taler-specific error code * @param obj raw JSON reply, or error details if the request failed - * @param proposal_data completed contract, NULL on error + * @param contract_terms completed contract, NULL on error * @param sig merchant's signature over the contract, NULL on error * @param hash proposal data's hashcode, NULL on error */ @@ -61,7 +61,7 @@ typedef void unsigned int http_status, enum TALER_ErrorCode ec, const json_t *obj, - const json_t *proposal_data, + const json_t *contract_terms, const struct TALER_MerchantSignatureP *sig, const struct GNUNET_HashCode *hash); @@ -360,7 +360,7 @@ struct TALER_MERCHANT_TrackTransferHandle; /** * Information about the _total_ amount that was paid back - * by the exchange for a given h_proposal_data, by _one_ wire + * by the exchange for a given h_contract_terms, by _one_ wire * transfer. */ struct TALER_MERCHANT_TrackTransferDetails { diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index 71f14002..db27e0eb 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -32,18 +32,18 @@ struct TALER_MERCHANTDB_Plugin; /** - * Tipically called by `find_proposal_data_by_date`. + * Tipically called by `find_contract_terms_by_date`. * * @param cls closure * @param order_id order id * @param row_id serial numer of the transaction in the table, - * @param proposal_data proposal data related to order id + * @param contract_terms proposal data related to order id */ typedef void (*TALER_MERCHANTDB_ProposalDataCallback)(void *cls, const char *order_id, uint64_t row_id, - const json_t *proposal_data); + const json_t *contract_terms); /** * Function called with information about a transaction. @@ -51,7 +51,7 @@ struct TALER_MERCHANTDB_Plugin; * @param cls closure * @param merchant_pub merchant's public key * @param exchange_uri URI of the exchange - * @param h_proposal_data proposal data's hashcode + * @param h_contract_terms proposal data's hashcode * @param h_wire hash of our wire details * @param timestamp time of the confirmation * @param refund refund deadline @@ -61,7 +61,7 @@ typedef void (*TALER_MERCHANTDB_TransactionCallback)(void *cls, const struct TALER_MerchantPublicKeyP *merchant_pub, const char *exchange_uri, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct GNUNET_HashCode *h_wire, struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute refund, @@ -72,7 +72,7 @@ typedef void * Function called with information about a coin that was deposited. * * @param cls closure - * @param h_proposal_data proposal data's hashcode + * @param h_contract_terms proposal data's hashcode * @param coin_pub public key of the coin * @param amount_with_fee amount the exchange will deposit for this coin * @param deposit_fee fee the exchange will charge for this coin @@ -81,7 +81,7 @@ typedef void */ typedef void (*TALER_MERCHANTDB_CoinDepositCallback)(void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *deposit_fee, @@ -91,13 +91,13 @@ typedef void /** * Information about the wire transfer corresponding to * a deposit operation. Note that it is in theory possible - * that we have a @a h_proposal_data and @a coin_pub in the + * that we have a @a h_contract_terms and @a coin_pub in the * result that do not match a deposit that we know about, * for example because someone else deposited funds into * our account. * * @param cls closure - * @param h_proposal_data hashcode of the proposal data + * @param h_contract_terms hashcode of the proposal data * @param coin_pub public key of the coin * @param wtid identifier of the wire transfer in which the exchange * send us the money for the coin deposit @@ -107,7 +107,7 @@ typedef void */ typedef void (*TALER_MERCHANTDB_TransferCallback)(void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_WireTransferIdentifierRawP *wtid, struct GNUNET_TIME_Absolute execution_time, @@ -169,29 +169,29 @@ struct TALER_MERCHANTDB_Plugin * @param order_id alphanumeric string that uniquely identifies the proposal * @param merchant_pub merchant's public key * @param timestamp timestamp of this proposal data - * @param proposal_data proposal data to store + * @param contract_terms proposal data to store * @return #GNUNET_OK on success, #GNUNET_SYSERR upon error */ int - (*insert_proposal_data) (void *cls, + (*insert_contract_terms) (void *cls, const char *order_id, const struct TALER_MerchantPublicKeyP *merchant_pub, struct GNUNET_TIME_Absolute timestamp, - const json_t *proposal_data); + const json_t *contract_terms); /** * Retrieve proposal data given its order ID. * * @param cls closure - * @param proposal_data where to store the result + * @param contract_terms where to store the result * @param order_id order_id used to lookup. * @param merchant_pub instance's public key. * @return #GNUNET_OK on success, #GNUNET_NO if no contract is * found, #GNUNET_SYSERR upon error */ int - (*find_proposal_data) (void *cls, - json_t **proposal_data, + (*find_contract_terms) (void *cls, + json_t **contract_terms, const char *order_id, const struct TALER_MerchantPublicKeyP *merchant_pub); @@ -200,16 +200,16 @@ struct TALER_MERCHANTDB_Plugin * Retrieve proposal data given its hashcode * * @param cls closure - * @param proposal_data where to store the result - * @param h_proposal_data hashcode used to lookup. + * @param contract_terms where to store the result + * @param h_contract_terms hashcode used to lookup. * @param merchant_pub instance's public key. * @return #GNUNET_OK on success, #GNUNET_NO if no contract is * found, #GNUNET_SYSERR upon error */ int - (*find_proposal_data_from_hash) (void *cls, - json_t **proposal_data, - const struct GNUNET_HashCode *h_proposal_data, + (*find_contract_terms_from_hash) (void *cls, + json_t **contract_terms, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub); @@ -233,7 +233,7 @@ struct TALER_MERCHANTDB_Plugin * @return numer of found tuples, #GNUNET_SYSERR upon error */ int - (*find_proposal_data_by_date_and_range) (void *cls, + (*find_contract_terms_by_date_and_range) (void *cls, struct GNUNET_TIME_Absolute date, const struct TALER_MerchantPublicKeyP *merchant_pub, unsigned int start, @@ -255,7 +255,7 @@ struct TALER_MERCHANTDB_Plugin * query being successful, unsuccessful, or generated errors. */ int - (*find_proposal_data_history) (void *cls, + (*find_contract_terms_history) (void *cls, const char *order_id, const struct TALER_MerchantPublicKeyP *merchant_pub, TALER_MERCHANTDB_ProposalDataCallback cb, @@ -276,7 +276,7 @@ struct TALER_MERCHANTDB_Plugin * @return numer of found tuples, #GNUNET_SYSERR upon error */ int - (*find_proposal_data_by_date) (void *cls, + (*find_contract_terms_by_date) (void *cls, struct GNUNET_TIME_Absolute date, const struct TALER_MerchantPublicKeyP *merchant_pub, unsigned int nrows, @@ -288,7 +288,7 @@ struct TALER_MERCHANTDB_Plugin * Insert transaction data into the database. * * @param cls closure - * @param h_proposal_data proposal data's hashcode + * @param h_contract_terms proposal data's hashcode * @param merchant_pub merchant's public key * @param exchange_uri URI of the exchange * @param h_wire hash of our wire details @@ -299,7 +299,7 @@ struct TALER_MERCHANTDB_Plugin */ int (*store_transaction) (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub, const char *exchange_uri, const struct GNUNET_HashCode *h_wire, @@ -312,7 +312,7 @@ struct TALER_MERCHANTDB_Plugin * Insert payment confirmation from the exchange into the database. * * @param cls closure - * @param h_proposal_data proposal data's hashcode + * @param h_contract_terms proposal data's hashcode * @param merchant_pub merchant's public key * @param coin_pub public key of the coin * @param amount_with_fee amount the exchange will deposit for this coin @@ -323,7 +323,7 @@ struct TALER_MERCHANTDB_Plugin */ int (*store_deposit) (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_Amount *amount_with_fee, @@ -333,11 +333,11 @@ struct TALER_MERCHANTDB_Plugin /** - * Insert mapping of @a coin_pub and @a h_proposal_data to + * Insert mapping of @a coin_pub and @a h_contract_terms to * corresponding @a wtid. * * @param cls closure - * @param h_proposal_data proposal data's hashcode + * @param h_contract_terms proposal data's hashcode * @param coin_pub public key of the coin * @param wtid identifier of the wire transfer in which the exchange * send us the money for the coin deposit @@ -345,7 +345,7 @@ struct TALER_MERCHANTDB_Plugin */ int (*store_coin_to_transfer) (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_WireTransferIdentifierRawP *wtid); @@ -390,7 +390,7 @@ struct TALER_MERCHANTDB_Plugin * Find information about a transaction. * * @param cls our plugin handle - * @param h_proposal_data proposal data's hashcode + * @param h_contract_terms proposal data's hashcode * @param merchant_pub merchant's public key. * @param cb function to call with transaction data * @param cb_cls closure for @a cb @@ -398,7 +398,7 @@ struct TALER_MERCHANTDB_Plugin */ int (*find_transaction) (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub, TALER_MERCHANTDB_TransactionCallback cb, void *cb_cls); @@ -408,37 +408,37 @@ struct TALER_MERCHANTDB_Plugin * Lookup information about coin payments by proposal data's hashcode. * * @param cls closure - * @param h_proposal_data proposal data's hashcode - * @param merchant_pub merchant's public key. It's AND'd with @a h_proposal_data + * @param h_contract_terms proposal data's hashcode + * @param merchant_pub merchant's public key. It's AND'd with @a h_contract_terms * in order to find the result. * @param cb function to call with payment data * @param cb_cls closure for @a cb - * @return #GNUNET_OK on success, #GNUNET_NO if h_proposal_data is unknown, + * @return #GNUNET_OK on success, #GNUNET_NO if h_contract_terms is unknown, * #GNUNET_SYSERR on hard errors */ int (*find_payments) (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub, TALER_MERCHANTDB_CoinDepositCallback cb, void *cb_cls); /** - * Lookup information about coin payments by h_proposal_data and coin. + * Lookup information about coin payments by h_contract_terms and coin. * * @param cls closure - * @param h_proposal_data proposal data's hashcode - * @param merchant_pub merchant's public key. It's AND'd with @a h_proposal_data + * @param h_contract_terms proposal data's hashcode + * @param merchant_pub merchant's public key. It's AND'd with @a h_contract_terms * in order to find the result. * @param coin_pub public key to use for the search * @param cb function to call with payment data * @param cb_cls closure for @a cb - * @return #GNUNET_OK on success, #GNUNET_NO if h_proposal_data is unknown, + * @return #GNUNET_OK on success, #GNUNET_NO if h_contract_terms is unknown, * #GNUNET_SYSERR on hard errors */ int (*find_payments_by_hash_and_coin) (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, TALER_MERCHANTDB_CoinDepositCallback cb, @@ -446,22 +446,22 @@ struct TALER_MERCHANTDB_Plugin /** - * Lookup information about a transfer by @a h_proposal_data. Note + * Lookup information about a transfer by @a h_contract_terms. Note * that in theory there could be multiple wire transfers for a - * single @a h_proposal_data, as the transaction may have involved + * single @a h_contract_terms, as the transaction may have involved * multiple coins and the coins may be spread over different wire * transfers. * * @param cls closure - * @param h_proposal_data proposal data's hashcode + * @param h_contract_terms proposal data's hashcode * @param cb function to call with transfer data * @param cb_cls closure for @a cb - * @return #GNUNET_OK on success, #GNUNET_NO if h_proposal_data is unknown, + * @return #GNUNET_OK on success, #GNUNET_NO if h_contract_terms is unknown, * #GNUNET_SYSERR on hard errors */ int (*find_transfers_by_hash) (void *cls, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, TALER_MERCHANTDB_TransferCallback cb, void *cb_cls); @@ -473,7 +473,7 @@ struct TALER_MERCHANTDB_Plugin * @param wtid wire transfer identifier to find matching transactions for * @param cb function to call with payment data * @param cb_cls closure for @a cb - * @return #GNUNET_OK on success, #GNUNET_NO if h_proposal_data is unknown, + * @return #GNUNET_OK on success, #GNUNET_NO if h_contract_terms is unknown, * #GNUNET_SYSERR on hard errors */ int @@ -491,7 +491,7 @@ struct TALER_MERCHANTDB_Plugin * @param wtid wire transfer identifier for the search * @param cb function to call with proof data * @param cb_cls closure for @a cb - * @return #GNUNET_OK on success, #GNUNET_NO if h_proposal_data is unknown, + * @return #GNUNET_OK on success, #GNUNET_NO if h_contract_terms is unknown, * #GNUNET_SYSERR on hard errors */ int diff --git a/src/lib/merchant_api_pay.c b/src/lib/merchant_api_pay.c index 47a7b8fb..9422e07e 100644 --- a/src/lib/merchant_api_pay.c +++ b/src/lib/merchant_api_pay.c @@ -252,7 +252,7 @@ handle_pay_finished (void *cls, * @param ctx the execution loop context * @param merchant_uri base URI of the merchant's backend * @param instance which merchant instance will receive this payment - * @param h_proposal_data hashcode of the proposal being paid + * @param h_contract_terms hashcode of the proposal being paid * @param amount total value of the contract to be paid to the merchant * @param max_fee maximum fee covered by the merchant (according to the contract) * @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests) @@ -273,7 +273,7 @@ struct TALER_MERCHANT_Pay * TALER_MERCHANT_pay_wallet (struct GNUNET_CURL_Context *ctx, const char *merchant_uri, const char *instance, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, const struct TALER_Amount *amount, const struct TALER_Amount *max_fee, const struct TALER_MerchantPublicKeyP *merchant_pub, @@ -307,7 +307,7 @@ TALER_MERCHANT_pay_wallet (struct GNUNET_CURL_Context *ctx, dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT); dr.purpose.size = htonl (sizeof (struct TALER_DepositRequestPS)); - dr.h_proposal_data = *h_proposal_data; + dr.h_contract_terms = *h_contract_terms; dr.h_wire = *h_wire; dr.timestamp = GNUNET_TIME_absolute_hton (timestamp); dr.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline); diff --git a/src/lib/merchant_api_proposal.c b/src/lib/merchant_api_proposal.c index 5a05c260..c200ce5b 100644 --- a/src/lib/merchant_api_proposal.c +++ b/src/lib/merchant_api_proposal.c @@ -115,14 +115,14 @@ handle_proposal_finished (void *cls, const json_t *json) { struct TALER_MERCHANT_ProposalOperation *po = cls; - json_t *proposal_data; + json_t *contract_terms; const struct TALER_MerchantSignatureP *sigp; const struct GNUNET_HashCode *hashp; struct TALER_MerchantSignatureP sig; struct GNUNET_HashCode hash; po->job = NULL; - proposal_data = NULL; + contract_terms = NULL; sigp = NULL; hashp = NULL; switch (response_code) @@ -132,7 +132,7 @@ handle_proposal_finished (void *cls, case MHD_HTTP_OK: { struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_json ("data", &proposal_data), + GNUNET_JSON_spec_json ("data", &contract_terms), GNUNET_JSON_spec_fixed_auto ("sig", &sig), GNUNET_JSON_spec_fixed_auto ("hash", &hash), GNUNET_JSON_spec_end() @@ -182,11 +182,11 @@ handle_proposal_finished (void *cls, response_code, TALER_JSON_get_error_code (json), json, - proposal_data, + contract_terms, sigp, hashp); - if (NULL != proposal_data) - json_decref (proposal_data); + if (NULL != contract_terms) + json_decref (contract_terms); } diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c index 5e683320..6d0f6138 100644 --- a/src/lib/test_merchant_api.c +++ b/src/lib/test_merchant_api.c @@ -421,7 +421,7 @@ struct Command * FIXME: verify in the code that this bit is actually proposal * data and not the whole proposal. */ - json_t *proposal_data; + json_t *contract_terms; /** * Proposal's signature. @@ -481,7 +481,7 @@ struct Command /** * Hashcode of the proposal data associated to this payment. */ - struct GNUNET_HashCode h_proposal_data; + struct GNUNET_HashCode h_contract_terms; /** * Merchant's public key @@ -1043,7 +1043,7 @@ reserve_withdraw_cb (void *cls, * @param ec taler-specific error code * @param obj the full received JSON reply, or * error details if the request failed - * @param proposal_data the order + additional information provided by the + * @param contract_terms the order + additional information provided by the * backend, NULL on error. * @param sig merchant's signature over the contract, NULL on error * @param h_contract hash of the contract, NULL on error @@ -1053,7 +1053,7 @@ proposal_cb (void *cls, unsigned int http_status, enum TALER_ErrorCode ec, const json_t *obj, - const json_t *proposal_data, + const json_t *contract_terms, const struct TALER_MerchantSignatureP *sig, const struct GNUNET_HashCode *hash) { @@ -1064,7 +1064,7 @@ proposal_cb (void *cls, switch (http_status) { case MHD_HTTP_OK: - cmd->details.proposal.proposal_data = json_incref ((json_t *) proposal_data); + cmd->details.proposal.contract_terms = json_incref ((json_t *) contract_terms); cmd->details.proposal.merchant_sig = *sig; cmd->details.proposal.hash = *hash; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -1105,7 +1105,7 @@ pay_cb (void *cls, struct Command *cmd = &is->commands[is->ip]; struct PaymentResponsePS mr; struct GNUNET_CRYPTO_EddsaSignature sig; - struct GNUNET_HashCode h_proposal_data; + struct GNUNET_HashCode h_contract_terms; const char *error_name; unsigned int error_line; @@ -1125,7 +1125,7 @@ pay_cb (void *cls, /* Check signature */ struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("sig", &sig), - GNUNET_JSON_spec_fixed_auto ("h_proposal_data", &h_proposal_data), + GNUNET_JSON_spec_fixed_auto ("h_contract_terms", &h_contract_terms), GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -1144,7 +1144,7 @@ pay_cb (void *cls, } mr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_PAYMENT_OK); mr.purpose.size = htonl (sizeof (mr)); - mr.h_proposal_data = h_proposal_data; + mr.h_contract_terms = h_contract_terms; if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_PAYMENT_OK, &mr.purpose, @@ -1418,7 +1418,7 @@ interpreter_run (void *cls) GNUNET_assert (NULL != ref); order_id = - json_string_value (json_object_get (ref->details.proposal.proposal_data, + json_string_value (json_object_get (ref->details.proposal.contract_terms, "order_id")); GNUNET_assert (NULL != (cmd->details.proposal_lookup.plo @@ -1653,7 +1653,7 @@ interpreter_run (void *cls) cmd->details.pay.contract_ref); GNUNET_assert (NULL != ref); merchant_sig = ref->details.proposal.merchant_sig; - GNUNET_assert (NULL != ref->details.proposal.proposal_data); + GNUNET_assert (NULL != ref->details.proposal.contract_terms); { /* Get information that need to be replied in the deposit permission */ struct GNUNET_JSON_Specification spec[] = { @@ -1669,7 +1669,7 @@ interpreter_run (void *cls) }; if (GNUNET_OK != - GNUNET_JSON_parse (ref->details.proposal.proposal_data, + GNUNET_JSON_parse (ref->details.proposal.contract_terms, spec, &error_name, &error_line)) @@ -1844,7 +1844,7 @@ interpreter_run (void *cls) GNUNET_assert (NULL != ref); proposal_ref = find_command (is, ref->details.pay.contract_ref); - order_id = json_string_value (json_object_get (proposal_ref->details.proposal.proposal_data, + order_id = json_string_value (json_object_get (proposal_ref->details.proposal.contract_terms, "order_id")); cmd->details.track_transaction.tth = TALER_MERCHANT_track_transaction (ctx, @@ -1983,10 +1983,10 @@ do_shutdown (void *cls) TALER_MERCHANT_proposal_cancel (cmd->details.proposal.po); cmd->details.proposal.po = NULL; } - if (NULL != cmd->details.proposal.proposal_data) + if (NULL != cmd->details.proposal.contract_terms) { - json_decref (cmd->details.proposal.proposal_data); - cmd->details.proposal.proposal_data = NULL; + json_decref (cmd->details.proposal.contract_terms); + cmd->details.proposal.contract_terms = NULL; } break; case OC_PAY: diff --git a/src/merchant-tools/taler-merchant-generate-payments.c b/src/merchant-tools/taler-merchant-generate-payments.c index 625ee339..9a4c3c07 100644 --- a/src/merchant-tools/taler-merchant-generate-payments.c +++ b/src/merchant-tools/taler-merchant-generate-payments.c @@ -336,7 +336,7 @@ struct Command * FIXME: verify in the code that this bit is actually proposal * data and not the whole proposal. */ - json_t *proposal_data; + json_t *contract_terms; /** * Proposal's signature. @@ -396,7 +396,7 @@ struct Command /** * Hashcode of the proposal data associated to this payment. */ - struct GNUNET_HashCode h_proposal_data; + struct GNUNET_HashCode h_contract_terms; /** * Merchant's public key @@ -469,7 +469,7 @@ next_command (struct InterpreterState *is) * @param ec taler-specific error code * @param obj the full received JSON reply, or * error details if the request failed - * @param proposal_data the order + additional information provided by the + * @param contract_terms the order + additional information provided by the * backend, NULL on error. * @param sig merchant's signature over the contract, NULL on error * @param h_contract hash of the contract, NULL on error @@ -479,7 +479,7 @@ proposal_cb (void *cls, unsigned int http_status, enum TALER_ErrorCode ec, const json_t *obj, - const json_t *proposal_data, + const json_t *contract_terms, const struct TALER_MerchantSignatureP *sig, const struct GNUNET_HashCode *hash) { @@ -490,7 +490,7 @@ proposal_cb (void *cls, switch (http_status) { case MHD_HTTP_OK: - cmd->details.proposal.proposal_data = json_incref ((json_t *) proposal_data); + cmd->details.proposal.contract_terms = json_incref ((json_t *) contract_terms); cmd->details.proposal.merchant_sig = *sig; cmd->details.proposal.hash = *hash; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -530,7 +530,7 @@ pay_cb (void *cls, struct Command *cmd = &is->commands[is->ip]; struct PaymentResponsePS mr; struct GNUNET_CRYPTO_EddsaSignature sig; - struct GNUNET_HashCode h_proposal_data; + struct GNUNET_HashCode h_contract_terms; const char *error_name; unsigned int error_line; @@ -550,7 +550,7 @@ pay_cb (void *cls, /* Check signature */ struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("sig", &sig), - GNUNET_JSON_spec_fixed_auto ("h_proposal_data", &h_proposal_data), + GNUNET_JSON_spec_fixed_auto ("h_contract_terms", &h_contract_terms), GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -569,7 +569,7 @@ pay_cb (void *cls, } mr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_PAYMENT_OK); mr.purpose.size = htonl (sizeof (mr)); - mr.h_proposal_data = h_proposal_data; + mr.h_contract_terms = h_contract_terms; if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_PAYMENT_OK, &mr.purpose, @@ -875,7 +875,7 @@ interpreter_run (void *cls) cmd->details.pay.contract_ref); GNUNET_assert (NULL != ref); merchant_sig = ref->details.proposal.merchant_sig; - GNUNET_assert (NULL != ref->details.proposal.proposal_data); + GNUNET_assert (NULL != ref->details.proposal.contract_terms); { /* Get information that need to be replied in the deposit permission */ struct GNUNET_JSON_Specification spec[] = { @@ -891,7 +891,7 @@ interpreter_run (void *cls) }; if (GNUNET_OK != - GNUNET_JSON_parse (ref->details.proposal.proposal_data, + GNUNET_JSON_parse (ref->details.proposal.contract_terms, spec, &error_name, &error_line)) @@ -1274,10 +1274,10 @@ do_shutdown (void *cls) TALER_MERCHANT_proposal_cancel (cmd->details.proposal.po); cmd->details.proposal.po = NULL; } - if (NULL != cmd->details.proposal.proposal_data) + if (NULL != cmd->details.proposal.contract_terms) { - json_decref (cmd->details.proposal.proposal_data); - cmd->details.proposal.proposal_data = NULL; + json_decref (cmd->details.proposal.contract_terms); + cmd->details.proposal.contract_terms = NULL; } break; -- cgit v1.2.3 From 1d3c450d377207cfd1ef8e583e65d01b67190322 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Tue, 30 May 2017 17:15:12 +0200 Subject: configuration subsection in manual --- doc/manual.texi | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/doc/manual.texi b/doc/manual.texi index 8a1d7c20..bc4742f1 100644 --- a/doc/manual.texi +++ b/doc/manual.texi @@ -741,6 +741,69 @@ reachable. Production systems should be configured to bind to a UNIX domain socket or properly restrict access to the port. +@chapter Configuration in Taler + +In Taler realm, any component obeys to the same pattern to get configuration +values. According to this pattern, once the component has been installed, the +installation deploys default values in @code{$@{prefix@}/share/taler/config.d/}, in +@emph{.conf} files. In order to override these defaults, the user can write a custom +@emph{.conf} file and either pass it to the component at execution time, or name it +@code{taler.conf} and place it under @code{$HOME/.config/}. + +A config file is a text file containing `sections`, and each section contains +its `values`. The right format follows:: + +@smallexample +[section1] +value1 = string +value2 = 23 + +[section2] +value21 = string +value22 = /path22 +@end smallexample + +Throughout any configuration file, it is possible to use @emph{$}-prefixed variables, +like @code{$VAR}, especially when they represent filesystem paths. +It is also possible to provide defaults values for those variables that are unset, +by using the following syntax: @code{$@{VAR:-default@}}. +However, there are two ways a user can set @emph{$}-prefixable variables: + +by defining them under a @code{[paths]} section, see example below, + +@smallexample +[paths] +TALER_DEPLOYMENT_SHARED = ${HOME}/shared-data +.. +[section-x] +path-x = ${TALER_DEPLOYMENT_SHARED}/x +@end smallexample + +or by setting them in the environment + +@smallexample +$ export VAR=/x +@end smallexample + +The configuration loader will give precedence to variables set under @code{[path]}, +though. + +The utility @code{taler-config}, which gets installed along with the exchange, +serves to get and set configuration values without directly editing the @emph{.conf}. +The option @code{-f} is particularly useful to resolve pathnames, when they use +several levels of @emph{$}-expanded variables. See @code{taler-config --help}. + +Note that, in this stage of development, the file @code{$HOME/.config/taler.conf} +can contain sections for @emph{all} the component. For example, both an exchange and +a bank can read values from it. + +The repository @emph{git://taler.net/deployment} contains examples of configuration +file used in our demos. See under @code{deployment/config}. + +Expectably, some components will not work just by using default values, as their +work is often interdependent. For example, a merchant needs to know an exchange +URL, or a database name. + @node Testing @chapter Testing -- cgit v1.2.3 From 7a62a58ef80dc3e2d546b60303d6554a46b01c38 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Tue, 30 May 2017 21:44:44 +0200 Subject: fix doc compilation error --- doc/manual.texi | 135 +++++++++++++++++++++++++++++-------------------------- doc/version.texi | 4 +- 2 files changed, 74 insertions(+), 65 deletions(-) diff --git a/doc/manual.texi b/doc/manual.texi index bc4742f1..c4c28d24 100644 --- a/doc/manual.texi +++ b/doc/manual.texi @@ -741,69 +741,6 @@ reachable. Production systems should be configured to bind to a UNIX domain socket or properly restrict access to the port. -@chapter Configuration in Taler - -In Taler realm, any component obeys to the same pattern to get configuration -values. According to this pattern, once the component has been installed, the -installation deploys default values in @code{$@{prefix@}/share/taler/config.d/}, in -@emph{.conf} files. In order to override these defaults, the user can write a custom -@emph{.conf} file and either pass it to the component at execution time, or name it -@code{taler.conf} and place it under @code{$HOME/.config/}. - -A config file is a text file containing `sections`, and each section contains -its `values`. The right format follows:: - -@smallexample -[section1] -value1 = string -value2 = 23 - -[section2] -value21 = string -value22 = /path22 -@end smallexample - -Throughout any configuration file, it is possible to use @emph{$}-prefixed variables, -like @code{$VAR}, especially when they represent filesystem paths. -It is also possible to provide defaults values for those variables that are unset, -by using the following syntax: @code{$@{VAR:-default@}}. -However, there are two ways a user can set @emph{$}-prefixable variables: - -by defining them under a @code{[paths]} section, see example below, - -@smallexample -[paths] -TALER_DEPLOYMENT_SHARED = ${HOME}/shared-data -.. -[section-x] -path-x = ${TALER_DEPLOYMENT_SHARED}/x -@end smallexample - -or by setting them in the environment - -@smallexample -$ export VAR=/x -@end smallexample - -The configuration loader will give precedence to variables set under @code{[path]}, -though. - -The utility @code{taler-config}, which gets installed along with the exchange, -serves to get and set configuration values without directly editing the @emph{.conf}. -The option @code{-f} is particularly useful to resolve pathnames, when they use -several levels of @emph{$}-expanded variables. See @code{taler-config --help}. - -Note that, in this stage of development, the file @code{$HOME/.config/taler.conf} -can contain sections for @emph{all} the component. For example, both an exchange and -a bank can read values from it. - -The repository @emph{git://taler.net/deployment} contains examples of configuration -file used in our demos. See under @code{deployment/config}. - -Expectably, some components will not work just by using default values, as their -work is often interdependent. For example, a merchant needs to know an exchange -URL, or a database name. - @node Testing @chapter Testing @@ -912,11 +849,83 @@ $ taler-merchant-dbinit -r @chapter Advanced topics @menu +* Configuration in Taler:: Configuration patterns * Using taler-config:: Introduction to the taler-config tool * Key management:: Managing the merchant's cryptographic keys * SEPA configuration:: Configuring a SEPA bank account @end menu +@node Configuration in Taler +@section Configuration in Taler +@cindex configuration + +In Taler realm, any component obeys to the same pattern to get configuration +values. According to this pattern, once the component has been installed, the +installation deploys default values in @cite{$@{prefix@}/share/taler/config.d/}, in +@cite{.conf} files. In order to override these defaults, the user can write a custom +@cite{.conf} file and either pass it to the component at execution time, or name it +@cite{taler.conf} and place it under @cite{$HOME/.config/}. + + +A config file is a text file containing @cite{sections}, and each section contains +its @cite{values}. The right format follows: + +@example +[section1] +value1 = string +value2 = 23 + +[section2] +value21 = string +value22 = /path22 +@end example + +Throughout any configuration file, it is possible to use @code{$}-prefixed variables, +like @code{$VAR}, especially when they represent filesystem paths. +It is also possible to provide defaults values for those variables that are unset, +by using the following syntax: @code{$@{VAR:-default@}}. +However, there are two ways a user can set @code{$}-prefixable variables: + +by defining them under a @code{[paths]} section, see example below, + +@example +[paths] +TALER_DEPLOYMENT_SHARED = $@{HOME@}/shared-data +.. +[section-x] +path-x = $@{TALER_DEPLOYMENT_SHARED@}/x +@end example + +or by setting them in the environment: + +@example +$ export VAR=/x +@end example + +The configuration loader will give precedence to variables set under @code{[path]}, +though. + +The utility @code{taler-config}, which gets installed along with the exchange, serves +to get and set configuration values without directly editing the @cite{.conf}. +The option @code{-f} is particularly useful to resolve pathnames, when they use +several levels of @code{$}-expanded variables. See @code{taler-config --help}. + +Note that, in this stage of development, the file @code{$HOME/.config/taler.conf} +can contain sections for @emph{all} the component. For example, both an exchange and +a bank can read values from it. + +The repository @code{git://taler.net/deployment} contains examples of configuration +file used in our demos. See under @code{deployment/config}. + +@cartouche +@quotation Note +Expectably, some components will not work just by using default values, as their +work is often interdependent. For example, a merchant needs to know an exchange +URL, or a database name. +@end quotation +@end cartouche + + @node Using taler-config @section Using taler-config @cindex taler-config diff --git a/doc/version.texi b/doc/version.texi index b89dc6e4..d4370a32 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 29 March 2017 -@set UPDATED-MONTH March 2017 +@set UPDATED 30 May 2017 +@set UPDATED-MONTH May 2017 @set EDITION 0.2.0 @set VERSION 0.2.0 -- cgit v1.2.3 From 64929e237de3249c5180df62a9bd0c5f62da39af Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Tue, 30 May 2017 21:55:48 +0200 Subject: fix doc compilartion warning --- doc/manual.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual.texi b/doc/manual.texi index c4c28d24..9da4582c 100644 --- a/doc/manual.texi +++ b/doc/manual.texi @@ -173,10 +173,10 @@ account information is encapsulated within the Taler backend. @node Installation @menu +* Installing Taler using Docker:: Installing Taler using Docker * generic-instructions:: Generic installation guidelines * Installing Taler on Debian GNU/Linux:: Installing Taler on Debian GNU/Linux @c * Installing Taler with GNU Guix:: Installing Taler with GNU Guix -* Installing Taler using Docker:: Installing Taler using Docker @c * Installing Taler on Arch Linux:: Installing Taler on Arch Linux @c * Installing Taler on Windows:: Installing Taler on Windows @c * Installing Taler on OS X:: Installing Taler on OS X -- cgit v1.2.3 From fc6ee7d0f6bb4c88f969baebc9a677d77cbc386e Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Fri, 2 Jun 2017 13:51:17 +0200 Subject: more diagnostics when storing/retrieving contract terms --- src/backenddb/plugin_merchantdb_postgres.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index 52996904..34266a7a 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -521,6 +521,11 @@ postgres_find_contract_terms (void *cls, PGresult *result; unsigned int i; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "finding contract term, order_id: '%s', merchant_pub: '%s'.\n", + order_id, + TALER_B2S (merchant_pub)); + struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (order_id), GNUNET_PQ_query_param_auto_from_type (merchant_pub), @@ -584,6 +589,12 @@ postgres_insert_contract_terms (void *cls, &h_contract_terms)) return GNUNET_SYSERR; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "inserting contract_terms: order_id: %s, merchant_pub: %s, h_contract_terms: %s.\n", + order_id, + TALER_B2S (merchant_pub), + GNUNET_h2s (&h_contract_terms)); + struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (order_id), GNUNET_PQ_query_param_auto_from_type (merchant_pub), @@ -659,8 +670,9 @@ postgres_store_transaction (void *cls, }; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Storing transaction with h_contract_terms '%s'\n", - GNUNET_h2s (h_contract_terms)); + "Storing transaction with h_contract_terms '%s', merchant_pub '%s'.\n", + GNUNET_h2s (h_contract_terms), + TALER_B2S (merchant_pub)); result = GNUNET_PQ_exec_prepared (pg->conn, "insert_transaction", @@ -1118,8 +1130,9 @@ postgres_find_transaction (void *cls, }; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Finding transaction for h_contract_terms '%s'\n", - GNUNET_h2s (h_contract_terms)); + "Finding transaction for h_contract_terms '%s', merchant_pub: '%s'.\n", + GNUNET_h2s (h_contract_terms), + TALER_B2S (merchant_pub)); result = GNUNET_PQ_exec_prepared (pg->conn, "find_transaction", -- cgit v1.2.3