diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-05-26 15:23:39 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-05-26 15:23:39 +0200 |
commit | b7f750950002474cb715fcb6ad2ac68d9551d6a7 (patch) | |
tree | 16f528922ff998527160f089d44dcce6691e95a1 | |
parent | d2393606d517676422e481d7e43431cfd5e7ffb3 (diff) |
change edate to wire_transfer_deadline/delay (#4521)
-rw-r--r-- | src/backend/merchant.conf | 2 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd.c | 8 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd.h | 6 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_pay.c | 25 | ||||
-rw-r--r-- | src/include/taler_merchant_service.h | 4 | ||||
-rw-r--r-- | src/lib/merchant_api_pay.c | 14 | ||||
-rw-r--r-- | src/tests/test_contract.c | 18 |
7 files changed, 41 insertions, 36 deletions
diff --git a/src/backend/merchant.conf b/src/backend/merchant.conf index 3f0b1e9d..e925c6de 100644 --- a/src/backend/merchant.conf +++ b/src/backend/merchant.conf @@ -24,7 +24,7 @@ WIREFORMAT = test # Determines which wire plugin will be used. We currently only # support one wire plugin at a time! -EDATE = 3 week +WIRE_TRANSFER_DELAY = 3 week # Configuration for postgres database. [merchantdb-postgres] diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index 038f7e6d..73541dd6 100644 --- a/src/backend/taler-merchant-httpd.c +++ b/src/backend/taler-merchant-httpd.c @@ -80,7 +80,7 @@ static char *keyfile; * This value tells the exchange by which date this merchant would like * to receive the funds for a deposited payment */ -struct GNUNET_TIME_Relative edate_delay; +struct GNUNET_TIME_Relative wire_transfer_delay; /** * Which currency is supported by this merchant? @@ -515,12 +515,12 @@ run (void *cls, if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (config, "merchant", - "EDATE", - &edate_delay)) + "WIRE_TRANSFER_DELAY", + &wire_transfer_delay)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "merchant", - "EDATE"); + "WIRE_TRANSFER_DELAY"); GNUNET_SCHEDULER_shutdown (); return; } diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h index 3594c01f..2ca3c20b 100644 --- a/src/backend/taler-merchant-httpd.h +++ b/src/backend/taler-merchant-httpd.h @@ -179,10 +179,10 @@ extern struct TALER_MERCHANTDB_Plugin *db; /** * If the frontend does NOT specify an execution date, how long should * we tell the exchange to wait to aggregate transactions before - * executing? This delay is added to the current time when we - * generate the advisory execution time for the exchange. + * executing the wire transfer? This delay is added to the current + * time when we generate the advisory execution time for the exchange. */ -extern struct GNUNET_TIME_Relative edate_delay; +extern struct GNUNET_TIME_Relative wire_transfer_delay; /** * Kick MHD to run now, to be called after MHD_resume_connection(). diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c index 89fe13c1..55a0c86d 100644 --- a/src/backend/taler-merchant-httpd_pay.c +++ b/src/backend/taler-merchant-httpd_pay.c @@ -182,11 +182,11 @@ struct PayContext struct GNUNET_HashCode h_contract; /** - * Execution date. How soon would the merchant like the - * transaction to be executed? (Can be given by the frontend - * or be determined by our configuration via #edate_delay.) + * Wire transfer deadline. How soon would the merchant like the + * wire transfer to be executed? (Can be given by the frontend + * or be determined by our configuration via #wire_transfer_delay.) */ - struct GNUNET_TIME_Absolute edate; + struct GNUNET_TIME_Absolute wire_transfer_deadline; /** * Response to return, NULL if we don't have one yet. @@ -623,7 +623,7 @@ process_pay_with_exchange (void *cls, dc->dh = TALER_EXCHANGE_deposit (mh, &dc->percoin_amount, - pc->edate, + pc->wire_transfer_deadline, j_wire, &pc->h_contract, &dc->coin_pub, @@ -802,18 +802,19 @@ MH_handler_pay (struct TMH_RequestHandler *rh, "invalid merchant signature supplied"); } - /* 'edate' is optional, if it is not present, generate it here; it - will be timestamp plus the edate_delay supplied in config - file */ - if (NULL == json_object_get (root, "edate")) + /* 'wire_transfer_deadline' is optional, if it is not present, + generate it here; it will be timestamp plus the + wire_transfer_delay supplied in config file */ + if (NULL == json_object_get (root, "wire_transfer_deadline")) { - pc->edate = GNUNET_TIME_absolute_add (pc->timestamp, - edate_delay); + pc->wire_transfer_deadline = GNUNET_TIME_absolute_add (pc->timestamp, + wire_transfer_delay); } else { struct GNUNET_JSON_Specification espec[] = { - GNUNET_JSON_spec_absolute_time ("edate", &pc->edate), + GNUNET_JSON_spec_absolute_time ("wire_transfer_deadline", + &pc->wire_transfer_deadline), GNUNET_JSON_spec_end() }; diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 540261b9..84bfc3e0 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -298,7 +298,7 @@ struct TALER_MERCHANT_PaidCoin * @param merchant_sig the signature of the merchant over the original contract * @param refund_deadline date until which the merchant can issue a refund to the customer via the merchant (can be zero if refunds are not allowed) * @param timestamp timestamp when the contract was finalized, must match approximately the current time of the merchant - * @param execution_deadline date by which the merchant would like the exchange to execute the transaction (can be zero if there is no specific date desired by the frontend). If non-zero, must be larger than @a refund_deadline. + * @param wire_transfer_deadline date by which the merchant would like the exchange to execute the wire transfer (can be zero if there is no specific date desired by the frontend). If non-zero, must be larger than @a refund_deadline. * @param exchange_uri URI of the exchange that the coins belong to * @param num_coins number of coins used to pay * @param coins array of coins we use to pay @@ -317,7 +317,7 @@ TALER_MERCHANT_pay_frontend (struct GNUNET_CURL_Context *ctx, const struct TALER_MerchantSignatureP *merchant_sig, struct GNUNET_TIME_Absolute refund_deadline, struct GNUNET_TIME_Absolute timestamp, - struct GNUNET_TIME_Absolute execution_deadline, + struct GNUNET_TIME_Absolute wire_transfer_deadline, const char *exchange_uri, unsigned int num_coins, const struct TALER_MERCHANT_PaidCoin *coins, diff --git a/src/lib/merchant_api_pay.c b/src/lib/merchant_api_pay.c index 5c579c71..c3c949c7 100644 --- a/src/lib/merchant_api_pay.c +++ b/src/lib/merchant_api_pay.c @@ -358,7 +358,7 @@ TALER_MERCHANT_pay_wallet (struct GNUNET_CURL_Context *ctx, * @param timestamp timestamp when the contract was finalized, must match approximately the current time of the merchant * @param transaction_id transaction id for the transaction between merchant and customer * @param refund_deadline date until which the merchant can issue a refund to the customer via the merchant (can be zero if refunds are not allowed) - * @param execution_deadline date by which the merchant would like the exchange to execute the transaction (can be zero if there is no specific date desired by the frontend). If non-zero, must be larger than @a refund_deadline. + * @param wire_transfer_deadline date by which the merchant would like the exchange to execute the wire transfer (can be zero if there is no specific date desired by the frontend). If non-zero, must be larger than @a refund_deadline. * @param num_coins number of coins used to pay * @param coins array of coins we use to pay * @param coin_sig the signature made with purpose #TALER_SIGNATURE_WALLET_COIN_DEPOSIT made by the customer with the coin’s private key. @@ -378,7 +378,7 @@ TALER_MERCHANT_pay_frontend (struct GNUNET_CURL_Context *ctx, const struct TALER_MerchantSignatureP *merchant_sig, struct GNUNET_TIME_Absolute refund_deadline, struct GNUNET_TIME_Absolute timestamp, - struct GNUNET_TIME_Absolute execution_deadline, + struct GNUNET_TIME_Absolute wire_transfer_deadline, const char *exchange_uri, unsigned int num_coins, const struct TALER_MERCHANT_PaidCoin *coins, @@ -400,8 +400,8 @@ TALER_MERCHANT_pay_frontend (struct GNUNET_CURL_Context *ctx, GNUNET_break (0); return NULL; } - if ( (0 != execution_deadline.abs_value_us) && - (execution_deadline.abs_value_us < refund_deadline.abs_value_us) ) + if ( (0 != wire_transfer_deadline.abs_value_us) && + (wire_transfer_deadline.abs_value_us < wire_transfer_deadline.abs_value_us) ) { GNUNET_break (0); return NULL; @@ -549,12 +549,12 @@ TALER_MERCHANT_pay_frontend (struct GNUNET_CURL_Context *ctx, "amount", TALER_JSON_from_amount (amount), "merchant_sig", GNUNET_JSON_from_data_auto (merchant_sig)); - if (0 != execution_deadline.abs_value_us) + if (0 != wire_transfer_deadline.abs_value_us) { /* Frontend did have an execution date in mind, add it */ json_object_set_new (pay_obj, - "edate", - GNUNET_JSON_from_time_abs (execution_deadline)); + "wire_transfer_deadline", + GNUNET_JSON_from_time_abs (wire_transfer_deadline)); } ph = GNUNET_new (struct TALER_MERCHANT_Pay); diff --git a/src/tests/test_contract.c b/src/tests/test_contract.c index 2e032334..bc62c0af 100644 --- a/src/tests/test_contract.c +++ b/src/tests/test_contract.c @@ -65,7 +65,7 @@ extern uint32_t TALER_MERCHANTDB_contract_get_values (PGconn *conn, const struct GNUNET_HashCode *h_contract, uint64_t *nounce, - struct GNUNET_TIME_Absolute *edate); + struct GNUNET_TIME_Absolute *wire_transfer_deadline); /** @@ -104,7 +104,7 @@ run (void *cls, char *const *args, const char *cfgfile, int64_t t_id; int64_t p_id; struct Contract contract; - struct GNUNET_TIME_Absolute edate; + struct GNUNET_TIME_Absolute wire_transfer_deadline; struct GNUNET_TIME_Absolute now; uint64_t nounce; struct GNUNET_HashCode h_contract_str; @@ -294,17 +294,21 @@ run (void *cls, char *const *args, const char *cfgfile, printf ("contract string : %s\n", aa); GNUNET_CRYPTO_hash (aa, strlen (aa) + 1, &h_contract_str); - if (GNUNET_SYSERR == TALER_MERCHANTDB_contract_get_values (db_conn, &h_contract_str, &nounce, &edate)) + if (GNUNET_SYSERR == + TALER_MERCHANTDB_contract_get_values (db_conn, + &h_contract_str, + &nounce, + &wire_transfer_deadline)) + { printf ("no hash found\n"); + } else { - fancy_time = GNUNET_STRINGS_absolute_time_to_string (edate); + fancy_time = GNUNET_STRINGS_absolute_time_to_string (wire_transfer_deadline); printf ("hash found!, nounce is : %llu\n", nounce); - printf ("hash found!, time is : %s\n", fancy_time); + printf ("hash found!, wire transfer time is : %s\n", fancy_time); } - - return; } |