summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-11-06 16:56:33 +0100
committerChristian Grothoff <christian@grothoff.org>2021-11-06 16:56:33 +0100
commitab6fd118b5cd23c414912f4fb7087f16d12f21a0 (patch)
tree8f6c24f697734df6a260808c42c233223c93a763
parent874a89a648c9f06e54a9e5a3bdc987a87ef8247b (diff)
downloadmerchant-ab6fd118b5cd23c414912f4fb7087f16d12f21a0.tar.gz
merchant-ab6fd118b5cd23c414912f4fb7087f16d12f21a0.tar.bz2
merchant-ab6fd118b5cd23c414912f4fb7087f16d12f21a0.zip
introduce TALER_wallet_deposit_verify
-rw-r--r--src/lib/merchant_api_post_order_pay.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c
index 98e2f359..08f041d4 100644
--- a/src/lib/merchant_api_post_order_pay.c
+++ b/src/lib/merchant_api_post_order_pay.c
@@ -600,27 +600,14 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx,
{
struct TALER_MERCHANT_PaidCoin pc[num_coins];
- struct TALER_DepositRequestPS dr = {
- .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT),
- .purpose.size = htonl (sizeof (dr)),
- .h_contract_terms = *h_contract_terms,
- .h_wire = *h_wire,
- .wallet_timestamp = GNUNET_TIME_absolute_hton (timestamp),
- .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
- .merchant = *merchant_pub
- };
for (unsigned int i = 0; i<num_coins; i++)
{
const struct TALER_MERCHANT_PayCoin *coin = &coins[i]; // coin priv.
struct TALER_MERCHANT_PaidCoin *p = &pc[i]; // coin pub.
struct TALER_Amount fee;
+ struct TALER_DenominationHash h_denom_pub;
- /* prepare 'dr' for this coin to generate coin signature */
- GNUNET_CRYPTO_eddsa_key_get_public (&coin->coin_priv.eddsa_priv,
- &dr.coin_pub.eddsa_pub);
- TALER_amount_hton (&dr.amount_with_fee,
- &coin->amount_with_fee);
if (0 >
TALER_amount_subtract (&fee,
&coin->amount_with_fee,
@@ -631,17 +618,24 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx,
GNUNET_break (0);
return NULL;
}
- TALER_amount_hton (&dr.deposit_fee,
- &fee);
TALER_denom_pub_hash (&coin->denom_pub,
- &dr.h_denom_pub);
- GNUNET_CRYPTO_eddsa_sign (&coin->coin_priv.eddsa_priv,
- &dr,
- &p->coin_sig.eddsa_signature);
+ &h_denom_pub);
+ TALER_wallet_deposit_sign (&coin->amount_with_fee,
+ &fee,
+ h_wire,
+ h_contract_terms,
+ NULL /* h_extensions! */,
+ &h_denom_pub,
+ timestamp,
+ merchant_pub,
+ refund_deadline,
+ &coin->coin_priv,
+ &p->coin_sig);
p->denom_pub = coin->denom_pub;
p->denom_sig = coin->denom_sig;
p->denom_value = coin->denom_value;
- p->coin_pub = dr.coin_pub;
+ GNUNET_CRYPTO_eddsa_key_get_public (&coin->coin_priv.eddsa_priv,
+ &p->coin_pub.eddsa_pub);
p->amount_with_fee = coin->amount_with_fee;
p->amount_without_fee = coin->amount_without_fee;
p->exchange_url = coin->exchange_url;