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: offer QR-code opt


From: gnunet
Subject: [taler-deployment] branch master updated: taler-local: offer QR-code option
Date: Wed, 08 Dec 2021 19:17:34 +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 e981bc5  taler-local: offer QR-code option
e981bc5 is described below

commit e981bc58dce3fa24a6d8d6776c6fa9639595a944
Author: ms <ms@taler.net>
AuthorDate: Wed Dec 8 19:17:25 2021 +0100

    taler-local: offer QR-code option
---
 bin/WIP/taler-local | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/bin/WIP/taler-local b/bin/WIP/taler-local
index 6a19ea4..d54e847 100755
--- a/bin/WIP/taler-local
+++ b/bin/WIP/taler-local
@@ -15,6 +15,7 @@
 # You should have received a copy of the GNU General Public License
 # along with GNU Taler.  If not, see <https://www.gnu.org/licenses/>.
 
+import qrcode
 import signal
 import socket
 import shutil
@@ -1714,7 +1715,14 @@ def stop():
     help="Protocol accepred by the bank, defaults to 'http'",
     default="http"
 )
-def withdraw(bank_host, bank_proto):
+@click.option(
+    "--with-qr-code", is_flag=True,
+    help="""When specified, it prints the QR code on screen,
+and waits the user's input before confirming the operation
+at the bank.""",
+    default=False
+)
+def withdraw(bank_host, bank_proto, with_qr_code):
     print_nn("Create withdrawal operation...")
     bank_base_url = bank_proto + "://" + bank_host
     resp = requests.post(bank_base_url +
@@ -1733,7 +1741,14 @@ def withdraw(bank_host, bank_proto):
     print(" OK")
     print("Let wallet specify the reserve public key at the bank...")
     # Let wallet give the reserve public key to the bank.
-    subprocess.run(["taler-wallet-cli", "handle-uri", withdraw_uri], 
check=True)
+    if with_qr_code:
+        withdraw_QR_code = qrcode.QRCode()
+        withdraw_QR_code.add_data(withdraw_uri)
+        withdraw_QR_code.print_ascii()
+        print(withdraw_uri)
+        input("After scanning the code, press ENTER to wire funds to the 
Exchange: ")
+    else:
+        subprocess.run(["taler-wallet-cli", "handle-uri", withdraw_uri], 
check=True)
     # Let the user confirm the withdrawal operation and
     # get the bank wire the funds.
     print_nn("Confirm withdrawal operation at the bank...")
@@ -1748,9 +1763,11 @@ def withdraw(bank_host, bank_proto):
         print(error)
         exit(1)
     print(" OK")
-    print("Let wallet complete all pending operations")
-    subprocess.run(["taler-wallet-cli", "handle-uri", withdraw_uri], 
check=True)
-    subprocess.run(["taler-wallet-cli", "run-until-done"], check=True)
+    if not with_qr_code:
+       print("Let wallet complete all pending operations")
+       # FIXME: Why the following operation twice?
+       subprocess.run(["taler-wallet-cli", "handle-uri", withdraw_uri], 
check=True)
+       subprocess.run(["taler-wallet-cli", "run-until-done"], check=True)
 
 if __name__ == "__main__":
     cli()

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