gnunet-svn
[Top][All Lists]
Advanced

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

[taler-deployment] branch master updated: taler-local: configure tip res


From: gnunet
Subject: [taler-deployment] branch master updated: taler-local: configure tip reserve
Date: Tue, 30 Nov 2021 19:09:47 +0100

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

ms pushed a commit to branch master
in repository deployment.

The following commit(s) were added to refs/heads/master by this push:
     new 70389e1  taler-local: configure tip reserve
70389e1 is described below

commit 70389e1b6cc463d18fc284976f5de28696fc8cd5
Author: ms <ms@taler.net>
AuthorDate: Tue Nov 30 19:09:42 2021 +0100

    taler-local: configure tip reserve
---
 bin/WIP/taler-local | 83 +++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 61 insertions(+), 22 deletions(-)

diff --git a/bin/WIP/taler-local b/bin/WIP/taler-local
index 5b217f8..95b5bea 100755
--- a/bin/WIP/taler-local
+++ b/bin/WIP/taler-local
@@ -46,10 +46,6 @@ import errno
 from pathlib import Path
 from subprocess import Popen, DEVNULL, PIPE
 from datetime import datetime
-from requests_unixsocket import Session
-from flask import Flask, request, Response
-from werkzeug.datastructures import Headers
-from werkzeug.exceptions import HTTPException
 
 
 TALER_ROOT_DIR = Path.home() / ".taler"
@@ -674,6 +670,27 @@ def prepare():
     TALER_RUNTIME_DIR = TALER_ROOT_DIR / "runtime"
     TALER_DATA_DIR = TALER_ROOT_DIR / "data"
     TALER_UNIT_FILES_DIR = systemd_user_dir = Path.home() / ".config" / 
"systemd" / "user"
+
+    def create_tip_reserve():
+        payto = Command([
+            "taler-merchant-setup-reserve",
+            "--amount", f"{CURRENCY}:20",
+            "--exchange-url", REV_PROXY_URL + "/exchange/",
+            "--merchant-url", REV_PROXY_URL + 
f"/merchant-backend/instances/survey/",
+            "--apikey", f"Bearer {FRONTENDS_API_TOKEN}",
+            "--wire-method", WIRE_METHOD],
+            capture_stdout=True
+        ).run()
+
+        Command([
+            "libeufin-cli", "sandbox", "--sandbox-url",
+            SANDBOX_URL + "/demobanks/default/", "demobank",
+            "new-transaction", "--bank-account", "sandbox-account-survey",
+            "--payto-with-subject", payto, "--amount", f"{CURRENCY}:20"],
+            env = get_sandbox_cli_env(
+                username = "sandbox-account-survey",
+                password = ALL_INSTANCES_BANK_PASSWORD
+            )).run()
     
     def get_random_iban():
         cc_no_check = 131400 # is "DE00"
@@ -682,19 +699,18 @@ def prepare():
         return "DE" + (f"0{check_digits}"[-2:]) + bban
 
     # IBANs
-    IBAN_EXCHANGE = get_random_iban()
-    IBAN_CUSTOMER = get_random_iban()
+   
     IBAN_MERCHANT_DEFAULT = get_random_iban()
     IBAN_MERCHANT_DEMOSHOP = get_random_iban()
 
     # Instances
-    INSTANCES = {
-        "GNUnet": IBAN_MERCHANT_DEMOSHOP,
-        "Taler": IBAN_MERCHANT_DEMOSHOP,
-        "Tor": IBAN_MERCHANT_DEMOSHOP,
-        "survey": IBAN_MERCHANT_DEMOSHOP,
-        "blog": IBAN_MERCHANT_DEMOSHOP
-    }
+    INSTANCES = [
+        "GNUnet",
+        "Taler",
+        "Tor", 
+        "survey",
+        "blog"
+    ]
     
     # Credentials / API keys
     EXCHANGE_NEXUS_USERNAME = "exchange-nexus-user"
@@ -1371,7 +1387,7 @@ def prepare():
     # Give each instance a Sandbox account (note: 'default')
     # won't have one, as it should typically only manage other
     # instances.
-    for instance_id, iban in INSTANCES.items():
+    for instance_id in INSTANCES:
         print_nn(f"Create account of {instance_id} at Sandbox...")
         prepare_sandbox_account(
             sandbox_url=SANDBOX_URL,
@@ -1528,9 +1544,11 @@ def prepare():
     print(" OK")
     
     def ensure_instance(
-            currency, instance_id,
-            backend_url, bank_hostname,
-            wire_method, merchant_wire_address,
+            currency,
+            instance_id,
+            backend_url,
+            bank_hostname,
+            wire_method,
             auth_token
         ):
         auth_header = {"Authorization": f"Bearer {auth_token}"}
@@ -1597,8 +1615,7 @@ def prepare():
         instance_id="default",
         backend_url = REV_PROXY_URL + "/merchant-backend",
         bank_hostname = REV_PROXY_NETLOC + "/sandbox",
-        wire_method = "iban",
-        merchant_wire_address = IBAN_MERCHANT_DEFAULT,
+        wire_method = WIRE_METHOD,
         auth_token=FRONTENDS_API_TOKEN
     )
 
@@ -1609,18 +1626,26 @@ def prepare():
         fail(f"Merchant backend did not re start correctly.")
     print(" OK")
 
-    for instance_id, iban in INSTANCES.items():
+    for instance_id in INSTANCES:
         print_nn(f"Creating the {instance_id} instance...")
         ensure_instance(
             currency=CURRENCY,
             instance_id=instance_id,
             backend_url = REV_PROXY_URL + "/merchant-backend",
             bank_hostname = REV_PROXY_NETLOC + "/sandbox",
-            wire_method = "iban",
-            merchant_wire_address = iban,
+            wire_method = WIRE_METHOD,
             auth_token=FRONTENDS_API_TOKEN
         )
         print(" OK")
+    print_nn("Creating tip reserve...")
+    create_tip_reserve()
+    print(" OK")
+    # 1 second to let Nexus read the payment from
+    # Sandbox, 1 second to let the Exchange Wirewatch
+    # to read the payment from Nexus.
+    print_nn("Sleep 2 seconds to let the tip reserve settle...")
+    time.sleep(2)
+    print(" OK")
 
 @cli.command()
 def launch():
@@ -1638,6 +1663,20 @@ def launch():
     subprocess.run(["systemctl", "--user", "start", 
"taler-local-survey.service"], check=True)
     subprocess.run(["systemctl", "--user", "start", 
"taler-local-landing.service"], check=True)
 
+    print((
+        "\n"
+        "Taler launched!\n\n"
+        f"Reach services at {REV_PROXY_URL + '/$service'}\n\n"
+        "Services:\n"
+        "  - exchange\n"
+        "  - merchant-backend\n"
+        "  - sandbox\n"
+        "  - nexus\n"
+        "  - blog\n"
+        "  - survey\n"
+        "  - donations\n"
+    ))
+
 @cli.command()
 def stop():
     subprocess.run(["systemctl", "--user", "stop", "taler-local-*.service"], 
check=True)

-- 
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]