gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: work on more testing for recoup-


From: gnunet
Subject: [taler-exchange] branch master updated: work on more testing for recoup-refresh
Date: Thu, 09 Jul 2020 23:27:19 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new af0a2c32 work on more testing for recoup-refresh
af0a2c32 is described below

commit af0a2c32a3592b3fe0a756ada1bf377c144a855b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Jul 9 23:27:16 2020 +0200

    work on more testing for recoup-refresh
---
 src/exchangedb/exchangedb_transactions.c | 11 +++----
 src/testing/test_exchange_api.c          | 50 +++++++++++++++++++++++++++++---
 2 files changed, 52 insertions(+), 9 deletions(-)

diff --git a/src/exchangedb/exchangedb_transactions.c 
b/src/exchangedb/exchangedb_transactions.c
index c1723958..11ed3ac7 100644
--- a/src/exchangedb/exchangedb_transactions.c
+++ b/src/exchangedb/exchangedb_transactions.c
@@ -42,13 +42,13 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
   struct TALER_Amount refunded;
   struct TALER_Amount deposit_fee;
   bool have_refund;
-  bool have_deposit_or_melt;
+  bool have_deposit_or_melt_or_recoup;
 
   GNUNET_assert (GNUNET_OK ==
                  TALER_amount_get_zero (spent.currency,
                                         &refunded));
   have_refund = false;
-  have_deposit_or_melt = false;
+  have_deposit_or_melt_or_recoup = false;
   for (struct TALER_EXCHANGEDB_TransactionList *pos = tl;
        NULL != pos;
        pos = pos->next)
@@ -57,7 +57,7 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
     {
     case TALER_EXCHANGEDB_TT_DEPOSIT:
       /* spent += pos->amount_with_fee */
-      have_deposit_or_melt = true;
+      have_deposit_or_melt_or_recoup = true;
       if (0 >
           TALER_amount_add (&spent,
                             &spent,
@@ -70,7 +70,7 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
       break;
     case TALER_EXCHANGEDB_TT_MELT:
       /* spent += pos->amount_with_fee */
-      have_deposit_or_melt = true;
+      have_deposit_or_melt_or_recoup = true;
       if (0 >
           TALER_amount_add (&spent,
                             &spent,
@@ -112,6 +112,7 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
       }
       break;
     case TALER_EXCHANGEDB_TT_RECOUP:
+      have_deposit_or_melt_or_recoup = true;
       /* spent += pos->value */
       if (0 >
           TALER_amount_add (&spent,
@@ -156,7 +157,7 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
-  GNUNET_break (have_deposit_or_melt);
+  GNUNET_break (have_deposit_or_melt_or_recoup);
   *ret = spent;
   return GNUNET_OK;
 }
diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c
index eb6a2b1b..7912041d 100644
--- a/src/testing/test_exchange_api.c
+++ b/src/testing/test_exchange_api.c
@@ -623,10 +623,10 @@ run (void *cls,
      * config.
      */
     CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-1",
-                              "EUR:5.01"),
+                              "EUR:15.02"),
     TALER_TESTING_cmd_check_bank_admin_transfer (
       "recoup-create-reserve-1-check",
-      "EUR:5.01",
+      "EUR:15.02",
       bc.user42_payto,
       bc.exchange_payto,
       "recoup-create-reserve-1"),
@@ -639,12 +639,26 @@ run (void *cls,
                                        "recoup-create-reserve-1",
                                        "EUR:5",
                                        MHD_HTTP_OK),
-    /* Make coin invalid */
+    /* Withdraw a 10 EUR coin, at fee of 1 ct */
+    TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-1b",
+                                       "recoup-create-reserve-1",
+                                       "EUR:10",
+                                       MHD_HTTP_OK),
+    /* melt 10 EUR coin to get 5 EUR refreshed coin */
+    TALER_TESTING_cmd_melt ("recoup-melt-coin-1b",
+                            "recoup-withdraw-coin-1b",
+                            MHD_HTTP_OK,
+                            "EUR:5",
+                            NULL),
+    TALER_TESTING_cmd_refresh_reveal ("recoup-reveal-coin-1b",
+                                      "recoup-melt-coin-1b",
+                                      MHD_HTTP_OK),
+    /* Revoke both 5 EUR coins */
     TALER_TESTING_cmd_revoke ("revoke-0-EUR:5",
                               MHD_HTTP_OK,
                               "recoup-withdraw-coin-1",
                               CONFIG_FILE),
-    /* Refund coin to bank account */
+    /* Recoup coin to reserve */
     TALER_TESTING_cmd_recoup ("recoup-1",
                               MHD_HTTP_OK,
                               "recoup-withdraw-coin-1",
@@ -655,6 +669,34 @@ run (void *cls,
                               "recoup-create-reserve-1",
                               "EUR:5.0",
                               MHD_HTTP_OK),
+    /* Recoup-refresh coin to 10 EUR coin */
+    TALER_TESTING_cmd_recoup ("recoup-1b",
+                              MHD_HTTP_OK,
+                              "recoup-reveal-coin-1b",
+                              "recoup-melt-coin-1b",
+                              "EUR:5"),
+#if FIXME
+    /* "over-spend" 10 EUR recoup-refreshed coin */
+    TALER_TESTING_cmd_deposit ("recoup-refresh-deposit-failing",
+                               "recoup-withdraw-coin-1b",
+                               0,
+                               bc.user42_payto,
+                               "{\"items\":[{\"name\":\"more ice 
cream\",\"value\":1}]}",
+                               GNUNET_TIME_UNIT_ZERO,
+                               "EUR:11.5",
+                               MHD_HTTP_OK),
+    // FIXME: yes, we expect 'CONFLICT', but the
+    // coin history we get is totally wrong!
+    /* "spend" 10 EUR recoup-refreshed coin */
+    TALER_TESTING_cmd_deposit ("recoup-refresh-deposit-ok",
+                               "recoup-withdraw-coin-1b",
+                               0,
+                               bc.user42_payto,
+                               "{\"items\":[{\"name\":\"more ice 
cream\",\"value\":1}]}",
+                               GNUNET_TIME_UNIT_ZERO,
+                               "EUR:9.5", /* FIXME: pick 'right' amount! */
+                               MHD_HTTP_OK),
+#endif
     /* Re-withdraw from this reserve */
     TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2",
                                        "recoup-create-reserve-1",

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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