From 00f340d97d14d796e0583ce81f06324373cfa1bd Mon Sep 17 00:00:00 2001 From: F-Node-Karlsruhe Date: Tue, 29 Jun 2021 10:08:37 +0200 Subject: [PATCH] improve manual payment check --- .gitignore | 3 ++- iota.py | 4 ++++ templates/pay.html | 19 +++++++++++-------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 07dba86..074c1be 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ iota/ .DS_store .env db/* -__pycache__/ \ No newline at end of file +__pycache__/ +env/ \ No newline at end of file diff --git a/iota.py b/iota.py index 517e836..7184205 100644 --- a/iota.py +++ b/iota.py @@ -162,6 +162,10 @@ def manual_payment_check(self, address, user_token_hash): self.unlock_content(user_token_hash, exp_time) + self.manual_payment_checks.remove(user_token_hash) + + return + # prevent key errors if user_token_hash in self.socket_session_ids.keys(): diff --git a/templates/pay.html b/templates/pay.html index 4fcdb84..58d1398 100644 --- a/templates/pay.html +++ b/templates/pay.html @@ -15,15 +15,17 @@ }); socket.on('payment_not_found', function() { console.log('Payment not found'); + document.getElementById("loader_text").innerHTML = 'Waiting for payment ...' }); $('#check_payment_button').on('click', function(){ socket.emit('check_payment', {user_token_hash: '{{ user_token_hash }}', iota_address: '{{ iota_address }}'}); + document.getElementById("loader_text").innerHTML = 'Searching for payment ...' }); - // show manual payment check after 30 seconds time - setTimeout("showCheckPayment()", 30000); + // show manual payment check after 30 seconds + setTimeout("enableCheckPayment()", 30000); }); - function showCheckPayment() { - document.getElementById("check_payment").style.display = "inline"; + function enableCheckPayment() { + document.getElementById("check_payment").style.display = 'inline'; }