diff options
author | ms <ms@taler.net> | 2021-12-08 19:17:25 +0100 |
---|---|---|
committer | ms <ms@taler.net> | 2021-12-08 19:17:25 +0100 |
commit | e981bc58dce3fa24a6d8d6776c6fa9639595a944 (patch) | |
tree | b484cff6e3d96aad9333daff675f839bc0795008 | |
parent | 821b505d488510cf91f542846d05e0d5b51e0326 (diff) | |
download | deployment-e981bc58dce3fa24a6d8d6776c6fa9639595a944.tar.gz deployment-e981bc58dce3fa24a6d8d6776c6fa9639595a944.tar.bz2 deployment-e981bc58dce3fa24a6d8d6776c6fa9639595a944.zip |
taler-local: offer QR-code option
-rwxr-xr-x | bin/WIP/taler-local | 27 |
1 files 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() |