[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: Use new exchange funcs: TALER_me
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: Use new exchange funcs: TALER_merchant_pay_{sign,verify} |
Date: |
Sun, 17 Apr 2022 11:00:16 +0200 |
This is an automated email from the git hooks/post-receive script.
ttn pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 0bd63c13 Use new exchange funcs: TALER_merchant_pay_{sign,verify}
0bd63c13 is described below
commit 0bd63c1394e73d4eba97145724e953d16d3029c0
Author: Thien-Thi Nguyen <ttn@gnuvola.org>
AuthorDate: Sun Apr 17 04:59:01 2022 -0400
Use new exchange funcs: TALER_merchant_pay_{sign,verify}
* src/backend/taler-merchant-httpd_post-orders-ID-paid.c
(TMH_post_orders_ID_paid): Rework to use ‘TALER_merchant_pay_verify’.
* src/backend/taler-merchant-httpd_post-orders-ID-pay.c
(execute_pay_transaction): Rework to use ‘TALER_merchant_pay_sign’.
* src/lib/merchant_api_post_order_pay.c
(handle_pay_finished): Rework to use ‘TALER_merchant_pay_verify’.
---
src/backend/taler-merchant-httpd_post-orders-ID-paid.c | 18 +++++++-----------
src/backend/taler-merchant-httpd_post-orders-ID-pay.c | 14 +++-----------
src/lib/merchant_api_post_order_pay.c | 12 +++---------
3 files changed, 13 insertions(+), 31 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
b/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
index 0e7ea59e..bc8ccfd9 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
@@ -67,13 +67,10 @@ TMH_post_orders_ID_paid (const struct TMH_RequestHandler
*rh,
struct MHD_Connection *connection,
struct TMH_HandlerContext *hc)
{
- struct TALER_PaymentResponsePS pr = {
- .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_PAYMENT_OK),
- .purpose.size = htonl (sizeof (pr))
- };
const char *order_id = hc->infix;
struct TALER_MerchantSignatureP merchant_sig;
const char *session_id;
+ struct TALER_PrivateContractHashP hct;
json_t *contract_terms;
const char *fulfillment_url;
enum GNUNET_DB_QueryStatus qs;
@@ -83,7 +80,7 @@ TMH_post_orders_ID_paid (const struct TMH_RequestHandler *rh,
GNUNET_JSON_spec_fixed_auto ("sig",
&merchant_sig),
GNUNET_JSON_spec_fixed_auto ("h_contract",
- &pr.h_contract_terms),
+ &hct),
GNUNET_JSON_spec_string ("session_id",
&session_id),
GNUNET_JSON_spec_end ()
@@ -104,10 +101,9 @@ TMH_post_orders_ID_paid (const struct TMH_RequestHandler
*rh,
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_PAYMENT_OK,
- &pr,
- &merchant_sig.eddsa_sig,
- &hc->instance->merchant_pub.eddsa_pub))
+ TALER_merchant_pay_verify (&hct,
+ &hc->instance->merchant_pub,
+ &merchant_sig))
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (connection,
@@ -164,7 +160,7 @@ TMH_post_orders_ID_paid (const struct TMH_RequestHandler
*rh,
TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH,
NULL);
}
- if (0 != GNUNET_memcmp (&pr.h_contract_terms,
+ if (0 != GNUNET_memcmp (&hct,
&h_contract_terms))
{
json_decref (contract_terms);
@@ -186,7 +182,7 @@ TMH_post_orders_ID_paid (const struct TMH_RequestHandler
*rh,
fulfillment_url);
qs = TMH_db->mark_contract_paid (TMH_db->cls,
hc->instance->settings.id,
- &pr.h_contract_terms,
+ &hct,
session_id);
/* If the order was paid already, we get qs == 0. */
if (0 > qs)
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
index 10dca3d9..375f0930 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -1927,17 +1927,9 @@ execute_pay_transaction (struct PayContext *pc)
/* Sign on our end (as the payment did go through, even if it may
have been refunded already) */
- {
- struct TALER_PaymentResponsePS mr = {
- .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_PAYMENT_OK),
- .purpose.size = htonl (sizeof (mr)),
- .h_contract_terms = pc->h_contract_terms
- };
-
- GNUNET_CRYPTO_eddsa_sign (&pc->hc->instance->merchant_priv.eddsa_priv,
- &mr,
- &sig);
- }
+ TALER_merchant_pay_sign (&pc->h_contract_terms,
+ &pc->hc->instance->merchant_priv,
+ &sig);
/* Build the response */
resume_pay_with_response (
diff --git a/src/lib/merchant_api_post_order_pay.c
b/src/lib/merchant_api_post_order_pay.c
index fc188a98..c246a1d4 100644
--- a/src/lib/merchant_api_post_order_pay.c
+++ b/src/lib/merchant_api_post_order_pay.c
@@ -265,11 +265,6 @@ handle_pay_finished (void *cls,
if (oph->am_wallet)
{
/* Here we can (and should) verify the merchant's signature */
- struct TALER_PaymentResponsePS pr = {
- .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_PAYMENT_OK),
- .purpose.size = htonl (sizeof (pr)),
- .h_contract_terms = oph->h_contract_terms
- };
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("sig",
&merchant_sig),
@@ -289,10 +284,9 @@ handle_pay_finished (void *cls,
}
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_PAYMENT_OK,
- &pr,
- &merchant_sig.eddsa_sig,
- &oph->merchant_pub.eddsa_pub))
+ TALER_merchant_pay_verify (&oph->h_contract_terms,
+ &oph->merchant_pub,
+ &merchant_sig))
{
GNUNET_break_op (0);
hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: Use new exchange funcs: TALER_merchant_pay_{sign,verify},
gnunet <=