fix use of struct TALER_DepositConfirmationPS
This commit is contained in:
parent
3c87b1a0b3
commit
cf13997ffc
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user