aboutsummaryrefslogtreecommitdiff
path: root/src/mint
diff options
context:
space:
mode:
Diffstat (limited to 'src/mint')
-rw-r--r--src/mint/taler-mint-httpd_db.c32
-rw-r--r--src/mint/taler-mint-httpd_responses.c18
-rw-r--r--src/mint/taler-mint-httpd_responses.h3
3 files changed, 30 insertions, 23 deletions
diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c
index 651cedfd1..dfbd9aac4 100644
--- a/src/mint/taler-mint-httpd_db.c
+++ b/src/mint/taler-mint-httpd_db.c
@@ -130,12 +130,13 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
&deposit->h_wire,
&deposit->h_contract,
deposit->transaction_id,
+ deposit->refund_deadline,
&deposit->merchant_pub,
&amount_without_fee);
}
mks = TMH_KS_acquire ();
dki = TMH_KS_denomination_key_lookup (mks,
- &deposit->coin.denom_pub);
+ &deposit->coin.denom_pub);
TALER_amount_ntoh (&value,
&dki->issue.value);
TMH_KS_release (mks);
@@ -151,15 +152,15 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
spent = deposit->amount_with_fee;
/* add cost of all previous transactions */
tl = TMH_plugin->get_coin_transactions (TMH_plugin->cls,
- session,
- &deposit->coin.coin_pub);
+ session,
+ &deposit->coin.coin_pub);
if (GNUNET_OK !=
calculate_transaction_list_totals (tl,
&spent,
&spent))
{
TMH_plugin->free_coin_transaction_list (TMH_plugin->cls,
- tl);
+ tl);
return TMH_RESPONSE_reply_internal_db_error (connection);
}
/* Check that cost of all transactions is smaller than
@@ -170,18 +171,18 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
TMH_plugin->rollback (TMH_plugin->cls,
session);
ret = TMH_RESPONSE_reply_deposit_insufficient_funds (connection,
- tl);
+ tl);
TMH_plugin->free_coin_transaction_list (TMH_plugin->cls,
- tl);
+ tl);
return ret;
}
TMH_plugin->free_coin_transaction_list (TMH_plugin->cls,
- tl);
+ tl);
if (GNUNET_OK !=
TMH_plugin->insert_deposit (TMH_plugin->cls,
- session,
- deposit))
+ session,
+ deposit))
{
TALER_LOG_WARNING ("Failed to store /deposit information in database\n");
TMH_plugin->rollback (TMH_plugin->cls,
@@ -197,12 +198,13 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
return TMH_RESPONSE_reply_commit_error (connection);
}
return TMH_RESPONSE_reply_deposit_success (connection,
- &deposit->coin.coin_pub,
- &deposit->h_wire,
- &deposit->h_contract,
- deposit->transaction_id,
- &deposit->merchant_pub,
- &deposit->amount_with_fee);
+ &deposit->coin.coin_pub,
+ &deposit->h_wire,
+ &deposit->h_contract,
+ deposit->transaction_id,
+ deposit->refund_deadline,
+ &deposit->merchant_pub,
+ &deposit->amount_with_fee);
}
diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c
index e8f657d25..0fe3f4700 100644
--- a/src/mint/taler-mint-httpd_responses.c
+++ b/src/mint/taler-mint-httpd_responses.c
@@ -276,18 +276,20 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection)
* @param h_wire hash of wire details
* @param h_contract hash of contract details
* @param transaction_id transaction ID
+ * @param refund_deadline until when this deposit be refunded
* @param merchant merchant public key
* @param amount_without_fee fraction of coin value to deposit, without the fee
* @return MHD result code
*/
int
TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection,
- const union TALER_CoinSpendPublicKeyP *coin_pub,
- const struct GNUNET_HashCode *h_wire,
- const struct GNUNET_HashCode *h_contract,
- uint64_t transaction_id,
- const struct TALER_MerchantPublicKeyP *merchant,
- const struct TALER_Amount *amount_without_fee)
+ const union TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct GNUNET_HashCode *h_wire,
+ const struct GNUNET_HashCode *h_contract,
+ uint64_t transaction_id,
+ struct GNUNET_TIME_Absolute refund_deadline,
+ const struct TALER_MerchantPublicKeyP *merchant,
+ const struct TALER_Amount *amount_without_fee)
{
struct TALER_DepositConfirmationPS dc;
struct TALER_MintSignatureP sig;
@@ -299,12 +301,14 @@ TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection,
dc.h_contract = *h_contract;
dc.h_wire = *h_wire;
dc.transaction_id = GNUNET_htonll (transaction_id);
+ dc.timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
+ dc.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline);
TALER_amount_hton (&dc.amount_without_fee,
amount_without_fee);
dc.coin_pub = *coin_pub;
dc.merchant = *merchant;
TMH_KS_sign (&dc.purpose,
- &sig);
+ &sig);
sig_json = TALER_json_from_eddsa_sig (&dc.purpose,
&sig.eddsa_signature);
ret = TMH_RESPONSE_reply_json_pack (connection,
diff --git a/src/mint/taler-mint-httpd_responses.h b/src/mint/taler-mint-httpd_responses.h
index 3cee66a08..616ce6ae7 100644
--- a/src/mint/taler-mint-httpd_responses.h
+++ b/src/mint/taler-mint-httpd_responses.h
@@ -179,6 +179,7 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection);
* @param h_wire hash of wire details
* @param h_contract hash of contract details
* @param transaction_id transaction ID
+ * @param refund_deadline until when this deposit be refunded
* @param merchant merchant public key
* @param amount_without_fee fraction of coin value to deposit (without fee)
* @return MHD result code
@@ -189,7 +190,7 @@ TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection,
const struct GNUNET_HashCode *h_wire,
const struct GNUNET_HashCode *h_contract,
uint64_t transaction_id,
- const struct TALER_MerchantPublicKeyP *merchant,
+ struct GNUNET_TIME_Absolute refund_deadline, const struct TALER_MerchantPublicKeyP *merchant,
const struct TALER_Amount *amount_without_fee);