gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] branch master updated (5a25fa6 -> 288034d)


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated (5a25fa6 -> 288034d)
Date: Thu, 22 Mar 2018 17:12:33 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a change to branch master
in repository merchant.

    from 5a25fa6  address leaks.
     new 152c64b  cover invalid /pay abortion.
     new 8d6bc6d  new paths in /pay abortions.
     new 288034d  cover pay abortion.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/backend/taler-merchant-httpd_pay.c |   6 +-
 src/lib/test_merchant_api_twisted.c    | 106 +++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+), 1 deletion(-)

diff --git a/src/backend/taler-merchant-httpd_pay.c 
b/src/backend/taler-merchant-httpd_pay.c
index eee23c1..3ac4f39 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -1226,6 +1226,7 @@ check_coin_paid (void *cls,
 
     if (GNUNET_YES == dc->found_in_db)
       continue; /* processed earlier */
+
     /* Get matching coin from results*/
     if ( (0 != memcmp (coin_pub,
                        &dc->coin_pub,
@@ -1663,6 +1664,8 @@ begin_transaction (struct PayContext *pc)
                           "Merchant database error (could not start 
transaction)");
     return;
   }
+
+  /* Init. some price accumulators.  */
   GNUNET_break (GNUNET_OK ==
                TALER_amount_get_zero (pc->amount.currency,
                                       &pc->total_paid));
@@ -1673,7 +1676,7 @@ begin_transaction (struct PayContext *pc)
                TALER_amount_get_zero (pc->amount.currency,
                                       &pc->total_refunded));
 
-  /* Check if some of these coins already succeeded */
+  /* Check if some of these coins already succeeded for _this_ contract.  */
   qs = db->find_payments (db->cls,
                          &pc->h_contract_terms,
                          &pc->mi->pubkey,
@@ -1725,6 +1728,7 @@ begin_transaction (struct PayContext *pc)
 
     /* The wallet is going for a refund,
        (on aborted operation)! */
+
     /* check payment was indeed incomplete */
     qs = db->find_paid_contract_terms_from_hash (db->cls,
                                                  &terms,
diff --git a/src/lib/test_merchant_api_twisted.c 
b/src/lib/test_merchant_api_twisted.c
index 216ac91..fe5c737 100644
--- a/src/lib/test_merchant_api_twisted.c
+++ b/src/lib/test_merchant_api_twisted.c
@@ -509,6 +509,112 @@ run (void *cls,
        "deposit-simple",
        "EUR:0.01"), // ignored
 
+    /****** Covering /pay *******/
+
+    /**
+     * Move money to the exchange's bank account.
+     */
+    CMD_TRANSFER_TO_EXCHANGE ("create-reserve-abort-1",
+                              "EUR:1.01"),
+
+    /**
+     * Make a reserve exist, according to the previous
+     * transfer.
+     */
+    CMD_EXEC_WIREWATCH ("wirewatch-abort-1"),
+
+    TALER_TESTING_cmd_check_bank_transfer
+      ("check_bank_transfer-abort-1",
+       "http://localhost:8081/";,
+       "EUR:1.01", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO),
+
+    TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-abort-1",
+                                       is->exchange,
+                                       "create-reserve-abort-1",
+                                       "EUR:1",
+                                       MHD_HTTP_OK),
+
+    TALER_TESTING_cmd_status ("withdraw-status-abort-1",
+                              is->exchange,
+                              "create-reserve-abort-1",
+                              "EUR:0",
+                              MHD_HTTP_OK),
+
+    TALER_TESTING_cmd_proposal
+      ("create-proposal-abort-1",
+       twister_merchant_url,
+       is->ctx,
+       MHD_HTTP_OK,
+       "{\"max_fee\":\
+          {\"currency\":\"EUR\",\
+           \"value\":0,\
+           \"fraction\":50000000},\
+        \"order_id\":\"abort-one\",\
+        \"refund_deadline\":\"\\/Date(0)\\/\",\
+        \"pay_deadline\":\"\\/Date(99999999999)\\/\",\
+        \"fulfillment_url\": \"https://example.com/\",\
+        \"amount\":\
+          {\"currency\":\"EUR\",\
+           \"value\":3,\
+           \"fraction\":0},\
+        \"summary\": \"merchant-lib testcase\",\
+        \"products\": [ {\"description\":\"ice cream\",\
+                         \"value\":\"{EUR:3}\"} ] }",
+        NULL),
+
+    TALER_TESTING_cmd_pay ("deposit-simple-for-abort",
+                           twister_merchant_url,
+                           is->ctx,
+                           0,
+                           "create-proposal-abort-1",
+                           "withdraw-coin-abort-1",
+                           "EUR:1",
+                           "EUR:1.99", // no sense now
+                           "EUR:0.01"), // no sense now
+
+    TALER_TESTING_cmd_delete_object ("hack-abort-1",
+                                     PROXY_MERCHANT_CONFIG_FILE,
+                                     "merchant_pub"),
+
+    TALER_TESTING_cmd_pay_abort ("pay-abort-1",
+                                 twister_merchant_url,
+                                 "deposit-simple-for-abort",
+                                 is->ctx,
+                                 0),
+
+    TALER_TESTING_cmd_delete_object
+      ("hack-abort-2",
+       PROXY_MERCHANT_CONFIG_FILE,
+       "refund_permissions.0.rtransaction_id"),
+
+    TALER_TESTING_cmd_pay_abort ("pay-abort-2",
+                                 twister_merchant_url,
+                                 "deposit-simple-for-abort",
+                                 is->ctx,
+                                 0),
+
+    TALER_TESTING_cmd_modify_object
+      ("hack-abort-3",
+       PROXY_MERCHANT_CONFIG_FILE,
+       "refund_permissions.0.coin_pub",
+       /* dummy coin.  */
+       "8YX10E41ZWHX0X2RK4XFAXB2D3M05M1HNG14ZFZZB8M7SA4QCKCG"),
+
+    TALER_TESTING_cmd_pay_abort ("pay-abort-3",
+                                 twister_merchant_url,
+                                 "deposit-simple-for-abort",
+                                 is->ctx,
+                                 0),
+    TALER_TESTING_cmd_flip_object
+      ("hack-abort-4",
+       PROXY_MERCHANT_CONFIG_FILE,
+       "refund_permissions.0.merchant_sig"),
+
+    TALER_TESTING_cmd_pay_abort ("pay-abort-4",
+                                 twister_merchant_url,
+                                 "deposit-simple-for-abort",
+                                 is->ctx,
+                                 0),
     /**
      * End the suite.  Fixme: better to have a label for this
      * too, as it shows a "(null)" token on logs.

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]