diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-29 01:18:14 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-29 01:18:14 +0200 |
commit | a0536b3b637a1ba6109f9f4b3a3b04a7763582fb (patch) | |
tree | 8ae0acf1fab91399afcbf9a9dd1d4ed446af1492 /src/backend | |
parent | 2f3564b833dc7f0fe0d20f495829cc4b7bab1621 (diff) | |
download | merchant-a0536b3b637a1ba6109f9f4b3a3b04a7763582fb.tar.gz merchant-a0536b3b637a1ba6109f9f4b3a3b04a7763582fb.tar.bz2 merchant-a0536b3b637a1ba6109f9f4b3a3b04a7763582fb.zip |
rename proposal_data to contract_terms (see #4879)
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/taler-merchant-httpd_history.c | 10 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_pay.c | 80 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_proposal.c | 10 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_track-transaction.c | 44 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_track-transfer.c | 24 |
5 files changed, 84 insertions, 84 deletions
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) |